ActiveMQ 新构建,最新版本不适用于最新 Java

ActiveMQ New build, latest version not working with latest Java

我正在新 windows 2016 服务器上安装 activemq。我已经安装了最新版本的 Java“1.8.0_321”和最新下载的 activemq“5.17.0”,但是当我尝试启动 activemq 时出现此错误:

Warning: JAVA_HOME environment variable is not set.

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(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access0(Unknown Source)
        at java.net.URLClassLoader.run(Unknown Source)
        at java.net.URLClassLoader.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
C:\Program Files (x86)\apache-activemq-5.17.0\bin>

设置JAVA_HOME变量: Java home variable

当我运行

echo %JAVA_HOME%

我明白了

C:\Program Files (x86)\Java\jre1.8.0_321\bin

由此我推断它是正确的?

有什么想法吗?

它在 ActiveMQ home page 上指出,ActiveMQ 5.17.0 版本需要 JDK 11+。

您的错误消息表明 Java 11 的 class version number,即 55。

要么将您的代码迁移到 Java 11,要么使用与 Java 8.

兼容的 ActiveMQ 5.16.4 release