Unsupported major.minor version 51.0?

I am trying to use notepad++ as my all-in-one tool edit, run, compile etc.

I have JRE installed, I have setup my path variable to …/bin directory.

When I run my “Hello world” in notepad++, I get this message:

java.lang.UnsupportedClassVersionError: test_hello_world :
Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)

The version number shown describes the version of the JRE the class file is compatible with.


The reported major numbers are:


J2SE 8 = 52,

J2SE 7 = 51,

J2SE 6.0 = 50,

J2SE 5.0 = 49,

JDK 1.4 = 48,

JDK 1.3 = 47,

JDK 1.2 = 46,

JDK 1.1 = 45

To fix the actual problem you should try to either run the Java code with newer version Java JRE or specify target parameter to the Java compiler to instruct the compiler to create code compatible with earlier Java versions.


For example in order to to generate class files compatible with Java 1.4, use the following command line:


javac -source 1.4 HelloWorld.java
java.lang.UnsupportedClassVersionError happens because of a higher JDK during compile time and lower JDK during runtime.


it is actually simple - you need to install both jre / jdk same version


JRE 6 -> JDK 6


JRE 7 -> JDK 7


and so on

This error means you’re trying to load a java “class” file that was compiled with a newer version of Java then you are trying to load it with.

For example, your .class file could have been compiled for JDK 7, and you’re trying to run it with JDK 6.

So the solution is to either:

Upgrade your java runtime or Recompile the class if you have the source, using your local java compiler (if you have one).

javac FileName.java