I have face error in running a compiled java class file.
Exception in thread “main” java.lang.UnsupportedClassVersionError: <class name>
(Unsupported major.minor version 50.0)
This error is caused when you compile a .java file with one version of JDK
and running the .class file with a different version of JVM
(the version of JDK is newer than JVM running .class file).
To check what version of your JDK or JVM, try this
=> javac 1.6.0_12
=> java version “1.4.2_03”
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
You can see there are different version, because you have install more than one version of java
so to fix this
set path=C:\Program Files\Java\jdk1.6.0_12\bin;%path%
but keep in mind, in c:\windows\system32, there is java.exe, so your path of c:\windows\system32 must place behind
set path=C:\Program Files\Java\jdk1.6.0_12\bin;c:\windows\system32;%path%