jvm - How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version -


i trying use notepad++ all-in-one tool edit, run, compile, etc.

i have jre installed, , have setup path variable .../bin directory.

when run "hello world" in notepad++, message:

java.lang.unsupportedclassversionerror: test_hello_world :  unsupported major.minor version 51.0     @ java.lang.classloader.defineclass1(native method)     @ java.lang.classloader.defineclasscond(unknown source)        ......................................... 

i think problem here versions; version of java may old or new.

  1. how fix it?
  2. should install jdk, , setup path variable jdk instead of jre?
  3. what difference between path variable in jre or jdk?

the version number shown describes version of jre class file compatible with.

the reported major numbers are:

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 

(source: wikipedia)

to fix actual problem should try either run java code newer version of java jre or specify target parameter java compiler instruct compiler create code compatible earlier java versions.

for example, in order generate class files compatible java 1.4, use following command line:

javac -target 1.4 helloworld.java 

with newer versions of java compiler warning bootstrap class path not being set. more information error available in blog post new javac warning setting older source without bootclasspath.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -