Deleting a file returned "file is currently in use."

I have the following method I use to delete the two files, when ran, I got the message "the file is currently in use."

I think that my mistake is to check if the file exists before delete, however I deleted this condition and I have the same message.

Any thoughts on how I can improve this feature?

public final static void deleteAllDatabase() {
FileConnection fconn_temp = null;
FileConnection fconn = null;
try {
fconn_temp = (FileConnection) Connector
    .open(System.getProperty("fileconn.dir.memorycard")
        + resource.getString(CoffeeHouseResource.db_path)
        + resource
            .getString(CoffeeHouseResource.db_template_name),
        Connector.READ_WRITE);
fconn = (FileConnection) Connector.open(
    System.getProperty("fileconn.dir.memorycard")
        + resource.getString(CoffeeHouseResource.db_path)
        + resource.getString(CoffeeHouseResource.db_name),
    Connector.READ_WRITE);

if (fconn_temp.exists() && fconn.exists()) {
  fconn_temp.delete();
  fconn.delete();
}

} catch (IOException e) {
Logger.logEventError("deleteAllDatabase error: " + e.getMessage());
} finally {
if (fconn_temp != null) {
  try {
    fconn_temp.close();
  } catch (IOException e) {
  }
}
if (fconn != null) {
  try {
    fconn.close();
  } catch (IOException e) {
  }
}
}
}

I think it's the names of common path between the two connections of file causing the error. Try to use a connection file and delete each file individually rather than have two connections to file and delete them simultaneously.

Tags: BlackBerry Developers

Similar Questions

  • BlackBerry BOLD 9700 Smartphone Can can't DELETE NOTE SPEECH "the file is currently in use"

    BOLD 9700 V5.0.0.296 (Platform 5.1.0.83)

    Make two short voice notes)<8s) as="" i="" explore="" my="" new="">

    Tried to remove the two of them and received the following message-

    "The file is currently being used"

    Returned and on the phone and was able to remove one of them - but the other I always get the message "the file is currently in use?

    Any help much appreciated!

    With the BlackBerry device powered time, remove battery for a few seconds and then reinsert the battery to restart.

    Now, delete it.

  • BlackBerry smartphones I can´t delete a photo. MSJ: (the file is currently in use)

    Hello! I took a few pictures with my BB cam, a few days later, I decided to delete these images, but every time I try the BB see the mw a message that says:
    "The file is currently being used"
    If I select OK; It does not remove it and this is the only option to select. Could someone let me know what can delete?

    Advanced thanks.

    Hello

    Assure us that first that no other application is using the file.

    Start your Blackberry in safe mode.

    Use the option of the Explorer in the main menu of the media to locate and delete the file.

    (Procedures with pictures are listed below).

    When you are finished with the file, and then restart (battery pull) your device in normal mode.

    Let us know how it goes!

    Thank you

    Bifocals

    How to start a BlackBerry smartphone in safe mode

    Explore the map media and internal memory content

    How to remove files from a BlackBerry smartphone

  • Office Express Error Msg: SENT file is currently being used by Outlook or by another application AND don't GET COMPACT. Help!

    Hello!
     
     
    I have both Outlook 2003 and Outlook Express 2003 loaded on my computer
    Only, I use Outlook Express and have not used regularly Outlook in 5 years.
    I have no problems using Express, (both in the sending or receiving of emails).
    There is no "snap-emails" sent or received in Outlook regular and none in the Outbox.  The same with the Express.
     
    About every month, compresses files Outlook Express and in doing so, the folder sent items do not get compressed, it does not create a new file SentItems.bak and it gives me the error: has SENT the file is currently being used by Outlook or by another application. 
     
    All the time this problem started, I received a number of updates to Office 2003 from Microsoft (probably updates 20-25).  They have installed without incident and that's the only problem resulting, I had with one of the components of Office.
     
    Thanks again for your help.  I'm looking forward to this problem so that it works correctly.
     
    John Murphy

    The sent items folder may have a corruption.  Create a new folder and copy the text in the folder into the new folder.  Then close OE and delete the file sent items.dbx.  OE will create a new.  DBX files should not receive more than a few hundred megabytes or they get corrupted.

    A more effective solution: since you seem to have corruption, it may mean that there are more, if you can set up a new message store by clicking file | Identities.  Then you can add your accounts, use the file | Import | Messages to bring them from the old identity.  Which will remove all corruption.

    Whatever it is, it's a good time to save your messages in OE, because it tends to remove them in unexpected ways.  See www.oehelp.com/OETips.aspx#6 also, if resumes default Outlook, he likes to do when he starts to date, just see www.oehelp.com/oedef.aspx

    See if that helps.

    Steve

  • "the file is currently being used"

    Hello world.

    I saw an Exception ("file is currently in use") when I want to delete a file, this is my code:

    private void writeXML(String result,int f) {
           DataOutputStream os = null;
           FileConnection fconn = null;
           String URL = "file:///SDCard/BlackBerry/documents/";
           String filename="";
            if(f==1){
            filename = "datos1.xml";
             }
            if(f==2){
            filename = "datos2.xml";
             }
    
        String fName=URL+filename;
        try {
                try {
        fconn = (FileConnection) Connector.open(fName, Connector.READ_WRITE);
                        if (fconn.exists()){
                            fconn.delete();
                            fconn.create();
                             os = fconn.openDataOutputStream();
                             os.write(result.getBytes());
                            }else{
                                 fconn.create();
                             os = fconn.openDataOutputStream();
                         os.write(result.getBytes());
    
                     }
                            //
    
                } catch (IOException e) {
                    System.out.println("ERROR");
                        System.out.println(e.getMessage());
                }finally{
    
                    os.close();
                    fconn.close();
    
                }
    

    Can someone help me?

    Thank you.

    PD: Sorry for my English

    If you delete a file,
    I think that you should close the connection and reopen it. If you want to keep the same file name, you can also call truncate (0) to move to the beginning of the file and overwrite it. In addition, if the file already exists, I don't think it is necessary to create it again.

  • Cannot remove printer drivers Canon MX350. The error that the driver files are currently in use.

    Original title: Canon MX350 printer

    I can't remove the MP (Canon MX350) drivers in my computer.  In the Remove Programs option request to remove the drivers but he tells me that the driver files are currently in use and is abandoned.  I deleted all the other software printer with no problems.  The printer has been set up with Wi - Fi.

    Thank you for your comments.

    Finally, I stumbled upon you are the indications you mention in step 1 above and finally managed to remove the MP drivers with the Remove programs in windows 8.  When this was removed successfully, I followed on by deleting all associated programs.  It removed all the Archives of the printer on my PC.

    I then reinstalled from the original disc and everything works fine now.

    Thank you once again.

    John

  • Too other files are currently in use by 16-bit programs.

    Hello

    I just installed service pack 1 on Windows 7, until Paintshop Pro 12 worked very well;

    now when I try to start the pc becomes slow and paintshop pro 12 does not,

    When I do a CTRL ALT DEL I get

    "TOO MUCH EITHER.
    THE FILES ARE CURRENTLY BEING USED IN 16 - BIT
    PROGRAMS. QUIT ONE OR MORE 16-BIT PROGRAMS
    OR INCREASE THE VALUE OF THE FILES COMMAND IN YOUR CONFIG.

    Help...

    Hello

    You can configure the computer to clean the start State and to check if any of th part ethirs application is causing the problem. To configure your computer to clean boot follow the link below.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: When you are finished troubleshooting, follow step 7 article to start on normal startup.

    Hope that information was useful

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • I deleted the file from my desktop using Shift + Delete how to recover this file?

    Earlier I deleted my desktop using 'Shift + delete' important file how to recover this file?

    Please see the thread of the following responses:

    How can I recover the files deleted (with shift-delete)

    This solution provided by 101 pretty much says it all.

  • Cannot delete the file... the file is open

    Hello. I am currently using Windows Vista Home Premium. I try to delete files (created in various graphics programs), but I get a message saying that the files are currently in use and that I need to close them before I can remove them. Except that the files are not in use... they are not open anywhere. Even when I restart the computer, I get the same message. I'm the only person using this computer. Any suggestions?

    Hello

    Same here, site of the author shows a security warning if I gave the Softpedia Website for access.
    Do not forget that security is also affected by the security programs you are running and your settings.

    UnLocker has been reported as having problems on Vista 64-bit.

    Site of the author, now supported Vista - download from Softpedia as site of the author shows a problem of law
    now with the download.
    http://ccollomb.free.fr/Unlocker/   <--- site="" has="">

    UnLocker 1.88
    http://www.Softpedia.com/get/system/system-miscellaneous/unlocker.shtml<-- download="" unlocker="">

    Download - SAVE - go to where you put it-click on - RUN AS ADMIN

    Below also work on Vista 64 bit

    Another good alternative - use FileAssassin:

    FileAssassin - free
    http://www.Malwarebytes.org/fileassassin.php

    Force delete (cannot delete) closed or in used files or folders with FileASSASSIN
    http://www.mydigitallife.info/2008/12/27/force-delete-cannot-delete-locked-or-in-used-files-or-folders-with-FileASSASSIN/

    Download - SAVE - go to where you put it-click on - RUN AS ADMIN

    And this - MoveOnBoot

    MoveOnBoot
    http://www.softwarepatch.com/software/MoveOnBoot.html

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • How can I delete a file in use by demon updater?

    How can I delete a file that says it's in use by Daemon updater.exe?

    I have a computer with a hard drive of GB 914, who recently said that it is impossible to install a program because the disk is full. While they inspected, I found that it only reported about 200 GB of usage and after you remove files non-essential, I released 57 GB of disk space.

    I made sure to show all files and installed a file tree Locator and found a log of 684 GB file but when I tried to remove it, it said that the file was not in the specified location. Then I manually found the file in system32 tree and he said that it is impossible to delete the file because it is used by daemonupdater.exe.

    can anyone help please?

    Credonem, welcome to the forum.

    I suggest start safe mode to see if that helps with your problem.  Safe mode starts only the drivers and programs needed.

    Please, click on "Thumbs Up +" if I helped you and click "Accept as Solution" If your problem is resolved.

  • Why the trash has not deleted a file? Where is he?

    Hello. Using Vista Business SP2.

    I did drag a file on the desktop in a window of the trash. I had the SHIFT while dragging. I drop the icon above the trash window.

    The file has literally disappeared. He is gone from the desktop. Never, he appeared in the trash to delete. Where is he? Is it deleted?

    Thank you.

    Hello

    If you hold the SHIFT key when you delete a file, you go around using the Recycle Bin.

    If you want an item to be sent to the trash, you can also > right-click on > select Delete > so it's in the trash if you want to restore it at a later Date for a reason, or delete "permanently".

    Now the SHIFT key by using the above method also allows to bypass the Recycle Bin.

    See you soon.

  • Error when you try to play audio files: Windows Media Player cannot access the file. The file may be in use, you won't have access to the computer where the file is stored

    Windows Media Player cannot access the file. The file may be in use, you won't have access to the computer on which the file is stored, or your proxy settings are may not be incorrect.

    I hope someone can help on Win 7 64 bit, music is taken on a disk usb2 external hard... I had no problem until today when the message in the title appeared next to each track, with a little red cross.

    I already deleted database library as suggested by some of the forums, also disabled the media as a feature of Win 7, rebooted and then re-enabled it.  I also disconnected externally and restarted that as well, I'm also the same mistake with a cd in the cd drive as well.

    Can anyone help?

    Hello

    This error may occur for one of the following reasons:
    The file is currently in use. Close the file and then try again.

    You are not allowed to access the location where the file is stored.

    Follow these steps to grant all permissions in the folder where the files are stored:
    1. right click on the folder on the external drive and click Properties.
    2. in the Properties window, click on Security tab.
    3. now, click Edit , and then click Add.
    4. now, type everyone in the box and click OK.
    5. check the full control box.
    6. click on apply and then click OK.

    You can also try the mentioned below as follows:

    1. click on start.
    2. go in Control Panel.
    3. Select "SOUND".
    4. double-click on speakers.
    5. click on the tab advanced and then uncheck the enable audio enhancements.

    Kind regards
    Amal-Microsoft Support.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to delete a file that is currently open in another program

    I tried to remove a few images and mp3 documents frostwire downloaded automatically for me. But every time I try to delete the documents that it says that the file is currently open in Frostwire. I uninstalled Frostwire to my computer and it still says it is in use, even if the Frostwire program is therefore longer on my computer

    All the proposals/solutions to this problem would be greatly apprieciated

    Hi Ian,

    1. What is the error message you get when you try to delete the file?

    Follow the steps in the link given below and check if that helps.

    Step 1: See the link below and follow the steps

    Access the link for more information about the error you receive below:

    Why can't I delete a file or a folder?

    http://Windows.Microsoft.com/en-us/Windows7/why-cant-I-delete-a-file-or-folder

    Step 2: You can also try to remove the file getting mode without failure.

    Access the link below to learn more about Safe Mode:

    Start your computer in Mode safe:

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

  • My InDesign Cs5 is currently blocked, while I deleted the file plugins SING. Please, someone help me.

    My InDesign CS5 is suspended, every time I start up my InDesign, I deleted the file plugins, but still his hanging, pls SING, somebody help me. My Photoshop Cs5, Illustrator Cs5 works correctly, but InDesign doesn't work do not.

    Hey, Peter I solved my problem of Bro in some fonts do not support my indesign. So, I took off bad fonts and now its all working properly.

    Thank you Peter for your help.

  • delete the file or ignore if it is already open

    I have a piece of code that dates back to the time of LabVIEW 7.1 who should write an ascii text file to a server once every 30 minutes.  Each half hour file is the previously published, to which is added another 30 minutes of data and 4 contains more data than does three 30 minutes so I iterate through a file number, 2, 3, 4, etc. and so on...  I write each new file I attempt to remove his predesessor such that in an ideal case there is only a single file sitting there at all times...  However, I want people to be able to open files on this server remotely any time they want to... In LabVIEW 7.1, if I tried to delete a file that was already open, it did NOT generate a stop error show but just went...  I could manually later then go start the file here or there that someone would open during the attempt to delete was made...

    But now I'm running in LabVIEW 2011 there is no the same luxury...  If I try to delete a file that is already open, the code generates an error and wait...  It is bad because nobody is there to answer...  I read another post on the search to see if the temporary files exist, but I don't know exactly what to look for so that people can use one of a slew of programs, reading from Excel to Matlab to WordPad to open these ascii text files...  Surely, there must be an attribute of a file that I can watch that will tell me it is currently open and if so, I can just ignore this deletion and move...

    Bottom line, it is how can I tell that a file on a server is opened by an unknown application on some Office far away?

    Thanks bob...

    Most likely, you are running in wiich auto error handling is enabled by default in new versions of LabVIEW (it did not exist in older versions). Whenever a function returns an error, but the error is not wired, it will appear an error message.

    Make sure that you manage the error in not leaving the error disconnected. (for example just Ingore by wiring up to a limit of structure) so it appears an automatic error dialog box.

Maybe you are looking for

  • generation iPod Nano 7 jumping battery percentage

    Hello. I recently got an opportunity 7th generation iPod Nano and the battery percentage jumps around. I use it and it seems that it is half-percent or less then I turn off the screen and turn the screen turn it on again to change the song and it wil

  • Satellite A60-181 heat up and turns off.

    Hope someone out there can help you.I was not able to use my A60-181 for awhile without being constantly plugged to electricity.And it seems to warm up and turns off. I bought a new battery, but I still get the same problem... and it is only 2 years

  • DAQmx showing not readings to multiple channels

    Hello I am trying to acquire values of temperature of 3 consecutive using a task DAQmx channel as shown in the attached photo. I have a loop of producer-consumer for fast reading and writing samples in a file. To specify the channels, I typed in the

  • bandpass filter

    Hello. I am applying a bandpass filter, blocking the frequencies below 0.1 Hz and above 5 Hz with sampling frequency of 50F - 3. I put it in place using a butterworkh as shown in attached but nothing comes out, my graph and table are empty. I have th

  • Windows 8 will not connect wireless for HP deskjet F2480

    I have a new HP laptop with windows 8 and tried setting to the top of my HP Deskjet F2480 printer by connecting the usb cable. The printer appears under "Devices", but it shows offline. Whenever I try to print something I just get a failed"" message.