简体   繁体   中英

UnsupportedClassVersionError: Unsupported major.minor version 51.0 JDK compiler is 1.7, JRE is java7

I want to use BaseX in eclipse. I installed and set up BaseX reffering to this site, as standalone. but 2 errors occurred when I execute query.

1st error is "UnsupportedClassVersionError."

I know this error occurred because of JDK version by past questions. But I confirmed that I set JDK compiler as 1.7 and installed JRE as java7. So, I have no idea at all.

And 2nd error is "Could not find the main class: org.basex.BaseX." I write "org.basex.BaseX" in Main class in Edit interpreter following to above site, but not choose..

My eclipse version is indigo.

error message is as below

java.lang.UnsupportedClassVersionError: org/basex/BaseX : Unsupported      major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.basex.BaseX.  Program will exit.
Exception in thread "main" 

When using Eclipse for Java development you could theoretically use three different JREs in combination:

  • One for running Eclipse it self, this is limited only by Eclipse's own requirements (1.8 as of Neon)
  • One for the libraries to compile against. This is what you see in the Build Path properties of your project. This decides what library classes and function can be referenced by your program (checked at compile time).
  • One to launch your programs (Run / Debug).

It's the latter that is relevant here. You'll find it all described starting from "Working with JREs" , then drill down into "Choosing a JRE for launching a project".

Of course, suitable defaults can reduce the effort to configure similar things in several locations, see, eg, "Choosing a default JRE" on the above help page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM