Elasticsearch:不支持的major.minor版本52.0

时间:2017-02-16 09:39:47

标签: java linux elasticsearch

我知道“不支持的major.minor版本52.0”错误指出java代码是使用Java 8编译的,并且尝试使用早期版本执行它。

我知道让JAVA_HOME和PATH指向正确版本的Java是suggested

从我能说的一切来看,我的系统已经指向了正确的版本:

me@computer ~ $ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
me@computer ~ $ which java
/home/me/bin/jdk1.8.0_102_64bit/bin/java
me@computer ~ $ echo $JAVA_HOME
/home/me/bin/jdk1.8.0_102_64bit

但是,在尝试执行elasticsearch时,我仍然会收到以下错误(通过apt-get安装):

me@computer ~ $ sudo -i service elasticsearch start
 * Starting Elasticsearch Server
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
...
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

修改

在基于ubuntu的linux上使用sudo重置PATH变量(与JAVA_HOME等其他变量相对),一个suggested solution是使用sudo env再次设置变量:

me@computer ~ $ sudo echo $JAVA_HOME
/home/me/bin/jdk1.8.0_102_64bit
me@computer ~ $ sudo java -version
java version "1.7.0_121"
OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode)
me@computer ~ $ sudo env PATH=$PATH java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

但是,这不适用于我的实际问题(启动Elasticsearch):

me@computer ~ $ sudo env PATH=$PATH service elasticsearch start
 * Starting Elasticsearch Server
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
...

1 个答案:

答案 0 :(得分:0)

1

在Debian Jessie上遇到同样的问题

经销商ID:Debian 描述:Debian GNU / Linux 8.6(jessie) 发布:8.6 代号:jessie