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 -version
=> javac 1.6.0_12

java -version
=> 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%


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: