Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:27:00+00:00 2026-06-14T20:27:00+00:00

I am getting following exception file :: Result000691.dat java.io.FileNotFoundException: D:\bio-rad\Result000691.dat (The process cannot access

  • 0
I am getting following exception

    file :: Result000691.dat
    java.io.FileNotFoundException: D:\bio-rad\Result000691.dat (The process cannot access the file because it is being used by another process)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileReader.<init>(Unknown Source)
        at com.sa.medisys.biorad.io.DirectoryFetcher.read(DirectoryFetcher.java:37)
        at com.sa.medisys.biorad.io.MessageAppender.main(MessageAppender.java:28)

**When am I getting exception:**

I have folder which is stored files that I have to read ,parse ,insert into Database then need to delete.

Exception occurs while program is running and I am trying to copy new files into directory.

**My program code::** 

    while (true) {        
                DirectoryFetcher fetch = new DirectoryFetcher();
                if (fetch.hasFile()) {              
                    for(File file:fetch.getFiles()){
                        if(file.isFile()){
                        logger.info("file :: "+ file.getName());

                        long  startTime = System.nanoTime();
                        //if(file.exists()){
                            boolean flag = fetch.read(file);
                            file.delete();
                        //}                  
    //                   if(flag){
    //                      
    //                   }  
                         long  stopTime = System.nanoTime();
                         System.out.println(stopTime - startTime);
                        }                   
                    }                       
                }
            }

     boolean read(File file){
            BufferedReader br = null;
            String line = null;
            boolean flag = false;
             StringBuffer appendMessage = null;
             String completeMessage = null;
            try {
                if(file.exists()){
                    br = new BufferedReader(new FileReader(file));
                     appendMessage = new StringBuffer(16384); 
                     while ((line = br.readLine()) != null) {                
                         appendMessage.append(line);
                         appendMessage.append('\n');                 
                    }            
                     if(appendMessage != null){
                         completeMessage = appendMessage.toString();
                     }  

                   //  logger.info("Message length " + completeMessage.length());
                    // logger.info("Message::" + completeMessage);

                    if (completeMessage != null) {
                        if (!completeMessage.equals("")) {              

                            flag = new BioRad().parse(completeMessage,file);
                                // logging ACK data into file

                        }
                    }
                }   
            } catch (FileNotFoundException e) {

                e.printStackTrace();
            }catch (Exception e) {

                e.printStackTrace();
            }

            finally{
                if(br != null){
                    try {
                        br.close();

                    } catch (IOException e) {

                        e.printStackTrace();
                    }
                }
            }


            return  flag ;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:27:01+00:00Added an answer on June 14, 2026 at 8:27 pm

    I think this problem is very clear:

    The process cannot access the file because it is being used by another process

    You need to wait until the other programm exits or revokes the read lock.

    A simple way to handle is to sleep and retry the operation later:

    for(int i=0; i<MAX_TRIES; i++) {
        try {
            // your io code:
            boolean flag = fetch.read(file);
            file.delete();
            break;
        } catch(FileNotFoundException ex) {
            Thread.sleep(1000);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following exception: Exception in thread main java.lang.ClassCastException: javax.crypto.CipherInputStream cannot be
I'm getting the following exception when uploading a file to Rackspace Cloud Files: Security
I am getting the following exception when trying to open HPROF file (created by
I'm trying to run the Terasort benchmarks and i'm getting the following exception: java.lang.RuntimeException:
I’m getting the following exception when trying to upload a file with the following
I am getting the following exception when trying to run my jar through java
I am getting following exception while ftp file over to some other machine. org.apache.commons.net.io.CopyStreamException:
I am trying to export the file but an getting the following exception: An
I am getting the following exception while trying to write an .xlsx file using
I am getting the following exception. java.util.NoSuchElementException: No line found I got this error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.