'ActiveMQ New build, latest version not working with latest Java

I am installing activemq on a new windows 2016 server. I have installed the latest version of Java "1.8.0_321" and the latest download of activemq "5.17.0", but when I try to start activemq I get this error:

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.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.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>

The JAVA_HOME variable is set: Java home variable

When I run

echo %JAVA_HOME%

I get

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

From that I would infer that it is correct?

Any ideas please?



Solution 1:[1]

It states, on the ActiveMQ home page, that ActiveMQ 5.17.0 release requires JDK 11+.

Your error message indicates the class version number of Java 11, i.e. 55.

Either migrate your code to Java 11 or use ActiveMQ 5.16.4 release which is compatible with Java 8.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abra