Question

How can I set my java jar application to use jre 6 instead of jre 7? I'm doing this because there are some compatibility issue with the libraries I'm using if the application use jre 7.

Edit: The application will come with its own installers (using advanced installer) that have a jre6 installer. But I don't know how to trace the installation folder of the jre6. How can I trace it and make the jar file use the jre6?

Was it helpful?

Solution

When running your application using java.exe, you could provide the absolute path to a Java 1.6 installation. Something like:

absolute_path_to_java6_dir/bin/java -jar yourRunnableJar.jar

or

absolute_path_to_java6_dir/bin/java -cp .;yourJar.jar;otherJarFiles className

OTHER TIPS

You can do this from Advanced Installer much simpler. You have two options:

  1. Force the package to use the JRE 1.6 found on the machine by going to "Virtual Machine" tab from Java Products page and setting the minimum and maximum JRE versions to 1.6

  2. Add as bundle in the project from the same page the JRE for version 1.6. This means that Advanced Installer will automatically import in your package the JRE resources required for your application, thus increases the package size, and will install them in the application's install folder. This JRE bundle will be used only by your application and removed along with it.

You could check the running JVM version when starting your application.

System.getProperty("java.version");

This way you could provide a meaningful explanation to end-user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top