Reputation: 154
I am trying to run ES on my server, and I got this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/tools/java_version_checker/JavaVersionChecker : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.elasticsearch.tools.java_version_checker.JavaVersionChecker. Program will exit.
It seems that the issue is related to the java version, Could you please advise if I do something wrong or there a special configuration should be taken before running the ES?
Please note that we have the following JDK versions install in the server:
Upvotes: 3
Views: 233
Reputation: 32386
The latest version of elasticsearch is not compatible with older version of Java and more details on the generic error Unsupported major.minor version 51.0
can be found here.
Also as mentioned in this official ES doc, ES will not start if compatible version of JVM isn't found.
Elasticsearch will refuse to start if a known-bad version of Java is used. The bundled JVM directory may be removed when using your own JVM.
And the entire supported version of JVM with a different version of elasticsearch can be found in this officially supported matrix link.
Going through your error message, it is clear that you are using 1.7 JDK version which uses 51
as a major version as mention in this SO answer. and if you check the above-supported matrix, on or after ES 5.X there isn't any support for less than JDK 1.8 version.
Hence you need to point your JDK to 1.8 version as its already installed in your system but not being used and there are a plethora of documents available on how to do it and after that, you should be able to start ES.
Upvotes: 2