java.io.IOException: The process cannot access the file because another process has locked a portion - when using IOUtils.copyLarge() in Windows -


the issue stemming specificied line of code in try block:

try {             finputstream = new fileinputstream(path); #thisline   bytecount += ioutils.copylarge(finputstream, foutputstream);             filecount++;     } 

the stack-trace looks this:

java.io.ioexception: process cannot access file because  process has locked portion   of file          @ java.io.fileinputstream.readbytes(native method)          @ java.io.fileinputstream.read(fileinputstream.java:233)          @ org.apache.commons.io.ioutils.copylarge(ioutils.java:1719)          @ org.apache.commons.io.ioutils.copylarge(ioutils.java:1696)  

this seems windows-specific issue. there file i/o best practice(s) specific windows might missing?

check if process accessing same file. on windows follow post figure out -> https://superuser.com/questions/399659/how-can-i-identify-what-application-is-using-a-given-file

it should work no other process accessing same file.

to make sure can access file consider reading following topic -> java: check if file open


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -