Reputation: 29
After searching all over the web, I am not able to solve my problem of Java execution. When using command prompt to run my "first" Java program, I am faced with the errors of Unsupported class version
and Main class not found. Program will exit
.
I have 2 versions of Java on my PC, Java 6 and 7. I have set the path of the JDK 7 in path environment variables and classpath too. I know the problem: I have javac -version
as 1.7.02 and java version
as 1.6.02, but how to change it and fix the problem?
Please elaborate the problem in easy and understandable language!
Upvotes: 3
Views: 302
Reputation: 1489
JRE [java command] come with your JDK 1.7, and you must change your JAVA_HOME variable to your JDK 1.7 folder.for this work read this article
Upvotes: 0
Reputation: 204766
You have to run your program with the same or higher version of java that yxou compiled it with.
So you can either compile your program with Java 6 on your PC or run it with java 7.
To run your program with java 7 just use the complete path to your java runtime environment. for instance
c:\jdk7\bin\jawaw.exe yourprogram
How to tell your system which Java version to use is explained here: Why does java -version returns old version?
Upvotes: 3