2
I have java 1.6 and 1.7 installed on my computer. I want to use 1.7 for everything except a single webapp that doesn't run on 1.7 well. Can I get some help?
EDIT: On windows but I need a fix for every OS
2
I have java 1.6 and 1.7 installed on my computer. I want to use 1.7 for everything except a single webapp that doesn't run on 1.7 well. Can I get some help?
EDIT: On windows but I need a fix for every OS
3
Make sure that PATH environment variable contains the bin directory of the 1.7 JRE. That way, everytime you use
java SomeClass
you'll use Java 7.
For your specific webapp, launch it using the absolute path of the Java 6 command:
/absolute/path/to/java6/bin/java ...
or
c:\absolute\path\to\java6\bin\java ...
on Windows.
This is a noob question but, where do I do this? – None – 2013-07-18T16:01:45.517
2in your console/shell window. Start menu - Execute - type 'cmd' <Enter>. If you want to be able to double-click on something to start a java app, create a .bat or .cmd script (under windows) or a .sh script (under Linux/MacOS). – user62916 – 2013-07-18T16:05:08.943
0
As the answer above states, you can just use the absolute path to the Java compiler for a webapp to use some specific version.
Another option for some applications is to add some switch or setting in an initialization file (typically has a .ini extension on Windows) - e.g. eclipse.ini. Some other Java programs like Sql Developer prompt to choose the version used, if the default is less than ideal.
0
"For every OS" — that is without a doubt not possible to give, but I can add specifics on Debian based systems to the existing answers.
Make sure the wanted Java version is installed and run:
sudo update-alternatives --config java
This will prompt you to choose which of the registered Java versions will be the target of /usr/bin/java
, and thus decide the default Java binary.
what OS are we talking about? – None – 2013-07-18T15:54:11.797
I'm using windows but I need it for every os – None – 2013-07-18T16:03:14.100
By "webapp" do you mean a Java applet running in the browser, for which you don't have the code? – Karan – 2013-07-19T02:01:01.237
This is one of the things doable with applets and java web start. – Thorbjørn Ravn Andersen – 2013-07-25T16:35:26.247