Wednesday, March 16, 2011

Exception in thread "main" java.lang.UnsupportedClassVersionError: Solved

If you get any error like this:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springfr

mework/roo/bootstrap/Main (Unsupported major.minor version 49.0)

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.access$100(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)


It is because you have not properly set path for java or you are using wrong version of java.

Solution (for windows):

Check the version of your jdk and jre executing following commands in command prompt:

javac -version

java -version

If any of this is showing no version or an old version set the path in environment variable ( set in both System and User variables).

Make sure you are using the latest version of java.

It will fix the problem,

Happy Coding!!


1 comment:

  1. Good post Privin, you have indeed cover the topic with great details. I have also documented my experience as how to resolve unsupportedclassversionerror in Java
    . let me know if you find it useful.

    ReplyDelete