ActiveMQ启动报错:this version of the Java Runtime only recognizes class file versions up to 52.0
报错信息
[root@localhost bin]# ./activemq
INFO: Loading '/home/activemq//bin/env'
INFO: Using java '/usr/local/jdk8/bin/java'
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/activemq/console/Main has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
Tasks provided by the sysv init script:
kill - terminate instance in a drastic way by sending SIGKILL
restart - stop running instance (if there is one), start new instance
console - start broker in foreground, useful for debugging purposes
status - check if activemq process is running
Configuration of this script:
The configuration of this script is read from the following files:
/etc/default/activemq /root/.activemqrc /home/activemq//bin/env
This script searches for the files in the listed order and reads the first available file.
Modify /home/activemq//bin/env or create a copy of that file on a suitable location.
To use additional configurations for running multiple instances on the same operating system
rename or symlink script to a name matching to activemq-instance-<INSTANCENAME>.
This changes the configuration location to /etc/default/activemq-instance-<INSTANCENAME> and
$HOME/.activemqrc-instance-<INSTANCENAME>.
解决思路
1.jdk版本问题
2.安装了多个jdk,去除其他jdk,保证Java -version 和javac -version一致