Eric Eric - 5 months ago 9
Java Question

execute JAR file using a specific version of the JRE

My JRE version is 1.8.0_77 but I want to run a JAR file with an older version of the JRE to see if the JAR will work on an older version of the JRE.

Is there a special command line option that I can add to the

java
command to do this, or do I have to download an older version of the JRE to do this?

I already looked at the
java -h
output...it seems like the answer is probably that I will have to download an older version of the JRE to do this...but I wanted to ask anyway...just in case.

Thanks!

Answer

Of course you will need to download and install older version(which you want to test with). Just run it in detailed path like:

/path/to/older/java.exe -jar whatever.jar

If you are using any IDE, it always provides the utility that run your code in custom ways: run in specific JRE, with different arguments and so on. Just make up a run task of your purpose.

Comments