Reputation: 2542
I have an old program that runs on JRE 1.6
, when you upgrade beyond that the program will not log in.
I've looked into upgrading it but cant seem to make it compatible with later JRE versions.
Problem is customers keep upgrading the JRE
on the machine it runs on, even when told not to.
Is it possible to install 2 JRE on a machine and specify which one to use when running my program?
I was thinking if the class path points to JRE 1.8 but i didn't use the classpath but the full address of the JRE 1.6, would that work ?
Edit:
java -Djava.library.path=lib/ -classpath .;lib/Serialio.jar;lib/log4j.jar;lib/client.jar -Djava.security.policy=java.policy 192.168.0.10 1098
this is my bat file, i've tried replacing -classpath with C:\jre1.5/bin/java.exe -jar but it thinks thats the name of my main class not the new class path, what am i doing wrong
Upvotes: 4
Views: 5857
Reputation: 26961
Is it possible to install 2 JRE on a machine and specify which one to use when running my program?
YES, if you execute the jar, you can run it from an specific JRE
path_to_jre/bin/java.exe -jar YourApp.jar
Simply put the above line in a .bat
file for your customers and double click will execute the program with defined java version, allowing your customers to upgrade java for other apps without problem.
java -Djava.library.path=lib/ -classpath .;lib/Serialio.jar;lib/log4j.jar;lib/client.jar -Djava.security.policy=java.policy 192.168.0.10 1098
is my bat file, i've tried replacing-classpath
withpath_to_jre/bin/java.exe -jar
it thinks thats the name of my main class not the new class path, what am i doing wrong
your bat file must be something similar to this (path to java is my own one):
C:\Program Files\Java\jre6\bin\java
-Djava.library.path=lib/
-classpath .;lib/Serialio.jar;lib/log4j.jar;lib/client.jar
-Djava.security.policy=java.policy 192.168.0.10 1098
Upvotes: 3