views:

270

answers:

4

I launch the following command line (process) from a Windows VC++ 6 program using CreateProcess (or _spawnv()):

  • java -cp c:\dir\updates.jar;c:\dir\main.jar Main

and class updates in updates.jar (overiding some in main.jar) are not read or found. It is as if the updates.jar library cannot be found or read.

If I launch the same line from a shortcut, or from the command line proper, everything IS found and executes properly.

If I launch a JVM from the command line, keep it running, AND THEN launch the executable stub (above), then everything works OK also. (This makes it look like the issue is a file rights thing).

Any insight would be greatly appreciated!

--Edward

A: 

Some more details...

This happens for Java 1.4.2 and 1.6.

If I query the classpath in the JVM instance it says 'c:\dir\updates.jar;c:\dir\main.jar', so it gets passed in correctly, just doesn't use classes in updates.jar.

Dwardo
A: 

Have you tried this on another machine? Another OS? Which JVM are you using? Have you tried different JVMs?

Can you provide us with a minimal example which demonstrates the problem?

JesperE
+1  A: 

Try using Microsoft's FileMon utility to figure out what's happening. Set the include filter to "updates" to focus in on the problem.

http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx

jdigital
A: 

Thanks jdigital!

I tried FileMon and it showed me what I was doing wrong. The executable calling CreateProcess() had an unclosed file handle to updates.jar from an attempt to copy the update JAR earlier. Bad code that works in the production environment, but not in the test environment.

Dwardo