My application needs to invoke java.exe on a remote Windows box. I install "my" version of the JVM on the Windows box, but my application doesn't know where. It just invokes "java.exe MyClass", with no absolute path. Therefore, the Windows box uses the PATH environment variable to locate java.exe. Unfortunately, it's finding an older version, not the one I installed.
I can't specify an absolute path.
I can't add my location to the BEGINNING of the PATH variable, as that would interfere with other software. Adding at the END doesn't help.
I don't really know enough to use the registry.
I had one idea, but I'm having trouble implementing it. Instead of directly invoking java.exe, I was going to invoke a .bat file called something like CALL_MY_JAVA.bat, which would then invoke the java.exe located in the same directory as it is. I could add this directory to the END of the PATH variable on the Windows box, which would then find it OK because it would (probably) be the only file with that name.
However, I'm having two problems with this. First, I can't get the .bat file to return it's own location, so I could use CD to change the current directory to it's own. Second, the whole thing sounds like a hack.
I'm sure this is a standard problem. What's the solution, Experts?
Thanks in advance,