Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Jun 23 '11 at 23:32

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

    
What JRE do you have installed? –  Marcelo Jun 23 '11 at 17:34
    
java -jar myjar.jar –  Alfredo O Jun 23 '11 at 17:36

4 Answers 4

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

javac -classpath ";%path_to_JDK6%/bin"
share|improve this answer
    
classpath parameter take jars and classes directory not binary' directories. –  h3xStream Jun 26 '11 at 21:49

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
    
This statement is false. Java 7 should be backward compatible once compile the same way Java 5 and 6 were. –  h3xStream Jun 26 '11 at 21:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.