Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (3.9k points)

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

I have JRE installed, and I have established my path variable to the .../bin directory.

When I try to run my "Hello world" in Notepad++, I get this output:

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)

   I think the issue here is about versions; some versions of Java may be old or too fresh.

  • How do I solve it?

  • Should I install the JDK, and set up my path variable to the JDK alternatively of JRE?

  • Can someone tell me the difference between the PATH variable in JRE or JDK?

1 Answer

0 votes
by (46k points)
  • To fix this problem you should try running the code with a new version of JAVA JRE or you can specify the target parameter to JAVA compiler, this will instruct the compiler to create code which is compatible with earlier versions of JAVA.

Example: To generate class files compatible with JAVA 1.4  you can use this command line:

javac -target 1.4

If you try this in newer versions of JAVA it will give a warning about bootstrap class not being set.  To solve this error you can click here.

Here are the major numbers of class file format describing versions of JRE and the class file it's compatible with:

Java SE 13 = 57,

Java SE 12 = 56,

Java SE 11 = 55,

Java SE 10 = 54,

Java SE 9 = 53,

Java SE 8 = 52,

Java SE 7 = 51,

Java SE 6.0 = 50,

Java SE 5.0 = 49,

JDK 1.4 = 48,

JDK 1.3 = 47,

JDK 1.2 = 46,

JDK 1.1 = 45

  • You have to install Both JRE/JDK with the same version. like:

           JRE 6 ->  JDK 6

           JRE 7  -> JDK 7

  • There’s no difference between the path variables of JDK and JRE, to set path difference you can use the following steps:

  • Open the command prompt

  • Copy the path of the JDK/bin directory

  • Write in command prompt: set path=copied_path


Run this in cmd

set path=C:\Program Files\Java\jdk1.6.0_23\bin


Related questions

0 votes
1 answer
0 votes
1 answer

Browse Categories