1

I have a Win7 Pro x64 Box with both JRE 7u80 and 8u60 (both are i586 versions) running since I have two applications that either need the one or the other to run.

I am aware of being able to start JAR-files by calling a batch with the according path to java.exe that's what I tried:

start "c:\Program Files (x86)\Java\jre7\bin\java.exe" "c:\samplepath\some.jar"

(It should be

start "c:\Program Files (x86)\Java\jre7\bin\java.exe" -jar "c:\samplepath\some.jar"

according to the documentation, but the -jar switch leads to an error that -jar couldn't be found)

This call does start the application without problems as long as Java 8 isn't installed which leads me to the conclusion it's probably ok.

While Java 8 is installed this call does "nothing" - well, almost. I can see the java process in task manager for a few seconds, then it disappears without a trace, there is no error message or whatsoever.

I even deleted the Java entry from %path% and rebooted, changed the order of the JRE installations, deactivated Java 8 in the Java control panel, no luck. If Java 8 is installed my jar won't run.

Talking to the developer isn't an option since he is no longer available. I am out of ideas here. Can somebody help with what I could try next?

Right now I keep the installation files on the desktop to install and dump Java 8 on demand which is quite a ridiculous and desperate manner to deal with it :-)

1

But the -jar switch leads to an error that -jar couldn't be found

Your start` syntax is incorrect:

  • If there is no title and command is surrounded by quotes "..." (because it contains spaces) then it is misinterpreted as a title.

  • In your case "c:\Program Files (x86)\Java\jre7\bin\java.exe" is interpreted as the title and -jar as a command (which of course cannot be found).

Your command should be:

start "title" "c:\Program Files (x86)\Java\jre7\bin\java.exe" -jar "c:\samplepath\some.jar"

You can use "" (empty string) as the title if you prefer:

start "" "c:\Program Files (x86)\Java\jre7\bin\java.exe" -jar "c:\samplepath\some.jar"

Syntax

START "title" [/D path] [options] "command" [parameters]

Key:

title       Text for the CMD window title bar (required.)
path        Starting directory.
command     The command, batch file or executable program to run.
parameters  The parameters passed to the command.

...

Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes ""

According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.

Source start

Further Reading

  • Thanks a lot - final solution is start /MIN "" "c:\Program Files (x86)\Java\jre7\bin\java.exe" -jar "c:\samplepath\some.jar". /MIN added to suppress the command window. Job done. – beerbear Aug 29 '15 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.