Question

My class path in environment variables are set to

C:\WINDOWS\system32;C:\Program Files (x86)\Java\jdk1.7.0_25\bin

I can compile fine, but I get an error when I try to run the java file.

Exception in thread "main" java.lang.UnsupportedClassVersionError: ASILogger : U
nsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
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$000(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)
Could not find the main class: ASILogger.  Program will exit.

Any ideas on what is going here?

Was it helpful?

Solution

Exception in thread "main" java.lang.UnsupportedClassVersionError: ASILogger : U
nsupported major.minor version 51.0

It seems you have compiled it against one version of java and running on another version. Read this tutorial may help.

OTHER TIPS

There is a version mismatch between your compiled and run time. See: unsupported-major-minor-version-51-0. Looks like you compiled a java version 7 but running in a java 6 VM.

java -version

will likely tell you that you are actually running an older version of java.

I recommend uninstalling older versions of Java from your system. Most likely you don't need then, and they might even have security issues (plus, they cause issues like this on unmanaged operating systems such as Windows).

There is no issue with your java configuration. You can use following command

 java -version 

to check wherether your java configuration working fine. seems to be you compiler version of java not compatible with your class language level

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top