ActiveMQ New build, latest version not working with latest Java - 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?

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.

Related

Can't Run the Web Application Project using IntelliJ IDEA | Glassfish

I have tried to create a web application project using IntelliJ IDEA and I am using a Glassfish 6.2.5 version as the server and JDK version is 1.8 but when I started the server it showed this error
Application Server was not connected before run
configuration stop, reason: Unable to ping server
at localhost:4848
is there someone who knows about this error please help me.
this is the log
C:\glassfish6\glassfish\bin\asadmin.bat start-domain domain1
C:\Users\Lakshitha\.jdks\corretto-1.8.0_312\bin\java.exe -Dfile.encoding=windows-1252 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.2\lib\idea_rt.jar" com.intellij.rt.execution.CommandLineWrapper C:\Users\Lakshitha\AppData\Local\Temp\idea_classpath1962225907 com.intellij.javaee.oss.process.JavaeeProcess 65261 com.intellij.javaee.oss.glassfish.agent.Glassfish51Agent
Error running admin process:
Message: com/sun/enterprise/admin/remote/RemoteSuccessException 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 Stack trace: java.lang.UnsupportedClassVersionError: com/sun/enterprise/admin/remote/RemoteSuccessException 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 java.lang.ClassLoader.loadClass(ClassLoader.java:351) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.intellij.javaee.oss.process.JavaeeProcess.main(JavaeeProcess.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:64) IDEA requires application server's bundled JDK to be 5.0+, please replace JDK manually
Process finished with exit code 0
[2022-04-27 04:13:03,148] Artifact Test WAP:war exploded: Waiting for server connection to start artifact deployment…
Detected server admin port: 4848
Detected server http port: 8080
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/glassfish/admin/cli/AsadminMain 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:\glassfish6\glassfish\bin\asadmin.bat stop-domain domain1
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/glassfish/admin/cli/AsadminMain 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)
Disconnected from server
The exception does not tell you that you need Java 8 but instead that Java 8 (class version 52) is too old to run classes compiled by version 55 (i.e. Java 11).
So you need to install JDK 11.

Compile with JDK 13 and run with JRE 8

I compiled my program, but when i try to run it, i get this error :
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: Lanceur has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the J ava 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)
I tried to "move" the JDK 13 all the way up in PATH, restarted my PC, but nothing changed. Here is a screenshot :
I then tried to download JRE 13, but can't find it anywhere.
How can i do this ?
I can't update to JDK 14 or up, because i need something that was removed in these versions
As you're compiling without a build environment, you'll need to build with:
javac -target 1.8 -source 1.8 MainClass.java
Java versioning is confusing but stick with 13 until you get used to it.

Problem with running my java code in command prompt [duplicate]

This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
Closed 3 years ago.
I have java versions 8 and 11 both installed. When I try to run any .java file in cmd using java command, I get the following message:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: aa 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)
I've tried installing a newer version of java but nothing has changed.
Java 11 should support file format 55 (https://en.wikipedia.org/wiki/Java_class_file#General_layout). Type java -version on commandline to figure out if you are using the correct installation. If not change your environemnt variables accordingly.

how to deploy jenkins on the jetty correctly?

I'm trying to deploy jenkins on the jetty application server as follows:
Unpack the distribution
[~]$ unzip jetty-distribution-9.3.2.v20150730
[~]$ cd jetty-distribution-9.3.2.v20150730
Copy your war into place
[jetty-distribution-9.3.2.v20150730]$ cp ~/Projects/mywebapp.war webapps/
Run Jetty
[jetty-distribution-9.3.2.v20150730]$ java -jar start.jar
My version of java is:
$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
I am getting the following message:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/eclipse/jetty/start/Main : Unsupported major.minor version 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)
Which version of the jetty I use with version 7 of java?
Java 7 is now EOL (End of Life) with Oracle.
Would highly recommend you use Java 8 from here on out.
Jenkins runs fine on Java 8 and Jetty 9.3.2 (the Jetty project themselves do this).
Jetty 9.3.x runs only with Java 1.8.
Jetty 9.0.x - 9.2.x runs with Java 1.7, so download latest stable 9.2.13.v20150730.

Error due to version compatibility in running jar file

I have created a jar file using JDK 8.0 and I tried to run the jar file in a system which is having JRE 7.0, but I am getting an error like this:
C:\Users\admin\Desktop>java -jar test.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: test : Uns
upported major.minor version 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)
What change am I need to make in my jar file creation. So that it will run without version compatibility?
You need to use the -source option for javac. For example:
javac -source 1.7 foo/Bar.java
In theory you can specify the source and target options separately, but judging by your comment, it sounds like you can't use Java 8 language features at all when targeting 1.7.
Note that this only covers your own source code. If xbasej-20091203.jar was built against Java 8, you'll need to find a version which targets Java 7 instead.

Categories