Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Jul 18 '13 at 16:53

This question came from our site for professional and enthusiast programmers.

what OS are we talking about? – roippi Jul 18 '13 at 15:54
I'm using windows but I need it for every os – user2210099 Jul 18 '13 at 16:03
By "webapp" do you mean a Java applet running in the browser, for which you don't have the code? – Karan Jul 19 '13 at 2:01
This is one of the things doable with applets and java web start. – Thorbjørn Ravn Andersen Jul 25 '13 at 16:35

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 ...


c:\absolute\path\to\java6\bin\java ...

on Windows.

share|improve this answer
This is a noob question but, where do I do this? – user2210099 Jul 18 '13 at 16:01
in 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 Jul 18 '13 at 16:05

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.

share|improve this answer

"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.

share|improve this answer

You must log in to answer this question.