Search code examples
javaactivemq-classic

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

  • 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.

    UPDATE (13 October 2023)

    There are two versions of ActiveMQ

    • Artemis
    • Classic

    As stated on the download page of both Classic (version 5.18.2 at time of writing) and Artemis (2.3.1.0), both versions require minimum JDK 11. However, both download pages have links to past releases.