file lock during exec() use

Hi, thanks for your attention.

I'm having the following problem: (using Java 6 and Windows XP)

I want to open an image tools from my java program, using an image file already existing, during my java program execution.

But when I try to save the edited image on the same file, the image tool cannot do it, apparently because of a file write lock on the original file.

I do not keep any lock or stream open on the file (dont even open the file), and the problem does not happen every time. Can anybody tell my if this is a normal behaviour, and a possible workaround if it exists?

Here is my code

// ....

java.io.File executable ="c:/windows/system32/mspaint";

String order =executable.getAbsolutePath() + c:/temp/image1.jpg";

Process proc= Runtime.getRuntime().exec(order,

null,executable.getParentFile());

proc.waitFor();

// ....

[1024 byte] By [toponuneza] at [2007-11-26 23:42:53]
# 1
By the way, I have the same problem if I try to use java.awt.Desktop or JDIC to open the file: if I try to save the edited file, I get (almost always, but not always) a "shared access violation" warning, and I cannot save it.Curious, isn't it?
toponuneza at 2007-7-11 15:12:11 > top of Java-index,Core,Core APIs...