0

I'm currently attempting to run a program through Java's 1.6 JRE instead of Java 7, but I'm not sure how to do that. Could anyone provide some insight as to what parameter I'd need and how to place it?

2
  • What JRE do you have installed?
    – Marcelo
    Jun 23, 2011 at 17:34
  • java -jar myjar.jar
    – Alfredo O
    Jun 23, 2011 at 17:36

4 Answers 4

1

There should be no difference in how you run it currently UNLESS you have built it with Java 1.7, in which case you will need to re-build it using Java 1.6 first.

1
  • This statement is false. Java 7 should be backward compatible once compile the same way Java 5 and 6 were.
    – h3xStream
    Jun 26, 2011 at 21:46
1

The Oracle version of Java does not support choosing the Java version as a parameter to the java command.

Here you choose which Java level you want to use, by choosing the appropriate java executable. Each installation brings its own java binary.

If you need to be explicit about this, you can use Java WebStart to do this. It knows about selecting the correct version of Java according to your specification in the jnlp-file.

0

On the command line, you make sure that your PATH environment variable points to the Java 1.6 directory before the Java 7 directory, or you call javac and java with the full path name.

In an IDE, an application server or any other thingy that provides Java as a service, you manipulate the appropriate configuration option - which is usually a thinly disguised equivalent to the PATH variable - so that the same thing applies.

0

You can specify the classpath as a command line option during compiling:

javac -classpath ";%path_to_JDK6%/bin"
1
  • classpath parameter take jars and classes directory not binary' directories.
    – h3xStream
    Jun 26, 2011 at 21:49

You must log in to answer this question.