Java on Yosemite - java

My java application cannot open in Yosemite.
the error message like this :
java.lang.UnsupportedClassVersionError: .../.../view/Launcher : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.install4j.runtime.MacLauncher.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at apple.launcher.LaunchRunner.run(LaunchRunner.java:116)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:51)
at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52)
I heard this message occur when the JRE1.7 is not installed.
So I checked the version in my console like this :
....-MacBook:~ thrisis$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.1
BuildVersion: 14B25
....-MacBook:~ thrisis$ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
....-MacBook:~ thrisis$
I'm very confused and please help me.
PS, sorry for my poor english.

It may also occur is 1.8 is not installed. Make sure you are running the latest versions of Java runtime environment (and Development kit if you need it).

I had the same problem and I fixed it by setting my JAVA_HOME
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
In my .zshrc file. I use zsh shell. You can do the same in your .bashrc or .profile
You mainly see this error when your "jar" is compiled with a higher JDK and you are trying to run it with a lower version. Check out this Wikipedia entry for reference.

Related

Travis CI: java.lang.UnsupportedClassVersionError

I am trying to setup CI for https://github.com/amCap1712/pljava using Travis. But it fails with following log:
find pljava-packaging -name \*.jar | sudo xargs java -jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/gjt/cuspy/JarX has
been compiled by a more recent version of the Java Runtime (class file version 53.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:757)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
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:419)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
The complete build log and travis config is available at https://travis-ci.org/github/amCap1712/pljava/builds/661687014 . I am using OpenJDK9 for this build but it fails for OpenJDK14 as well.
How to fix the error ?

How to resolve Unsupported major.minor version 51.0 error when trying to run Maven project Java [duplicate]

This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
Closed 7 years ago.
I'm not sure what has happened but I have a maven based Java project in Eclipse (Mars) where when I go to Run As-> Mvn install (from the UI), I've tried cleaning the project, Maven-> update project, mvn eclipse:eclipse, etc...nothing works
I get the following Exception thrown at me:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Earlier this was working with no trouble. This project is configured at with Java 1.6
I run mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.3", arch: "x86_64", family: "mac"
I run 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 have seen the other similar question which solutions like
export JAVA_HOME=<path to installed java version> but this does not work for me.
Any help or assistance would be much appreciated, thanks.
Configure java 1.7 for this project. As java version doesn't match with maven so please use java 1.7
It is clear that your default java version is 1.7
Go to project properties and from here set java 1.7 for your project. Hope this may help you out.

Groovy uses prohibited package name

I've installed groovy on my OS X via terminal and I can't run anything. The following exception occurs:
java.lang.SecurityException: Prohibited package name: java.lang
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:659)
at java.lang.ClassLoader.defineClass(ClassLoader.java:758)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:175)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:100)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
It seems that its developers used java.lang package name which makes the class loader angry.
If it can help I checked which tools.jar are found by startGroovy in the following lines:
208 # For Darwin, use classes.jar for TOOLS_JAR
209 TOOLS_JAR="$JAVA_HOME/lib/tools.jar"
In my case JAVA_HOME is:
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/
More details:
$ which java
/usr/bin/java
$ which groovy
/Users/maksim/.sdkman/candidates/groovy/current/bin/groovy
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/
echo $CLASSPATH is empty.
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Unsupported Class Version during Maven build in Jenkins

I've seen a few of these questions on here, but none of the solutions/tips seem to be pointing me in the right direction. So I have 3 JDK's installed in the locations of "/opt/java/6", "/opt/java/7", and "/opt/java/8". All of these are set in the global Jenkins configuration. Jenkins itself is run using Java 8 which is the system default JRE that I set manually through alternatives (I'm using CentOS 7). I had a bunch of old projects that are built using maven and the maven compiler plugin which is set to source=1.6 target=1.6 . Every time I try to execute a build with the Java 6 JDK I get
Started by user Antony Prince
ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/BitCalculator/lastSuccessful failed
java.nio.file.DirectoryNotEmptyException: /var/lib/jenkins/jobs/BitCalculator/lastSuccessful
at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at hudson.Util.createSymlinkJava7(Util.java:1194)
at hudson.Util.createSymlink(Util.java:1112)
at hudson.model.Run.createSymlink(Run.java:1851)
at hudson.model.Run.updateSymlinks(Run.java:1832)
at hudson.model.Run.execute(Run.java:1743)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
ln builds/lastStableBuild /var/lib/jenkins/jobs/BitCalculator/lastStable failed
java.nio.file.DirectoryNotEmptyException: /var/lib/jenkins/jobs/BitCalculator/lastStable
at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at hudson.Util.createSymlinkJava7(Util.java:1194)
at hudson.Util.createSymlink(Util.java:1112)
at hudson.model.Run.createSymlink(Run.java:1851)
at hudson.model.Run.updateSymlinks(Run.java:1833)
at hudson.model.Run.execute(Run.java:1743)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Building in workspace /var/lib/jenkins/workspace/BitCalculator
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url /home/git/repositories/java/BitCalculator.git # timeout=10
Fetching upstream changes from /home/git/repositories/java/BitCalculator.git
> git --version # timeout=10
> git fetch --tags --progress /home/git/repositories/java/BitCalculator.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse origin/master^{commit} # timeout=10
Checking out Revision 4f119f7783cc4ff00e5bf9bb27850ae7698d4fe8 (origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 4f119f7783cc4ff00e5bf9bb27850ae7698d4fe8
> git rev-list 4f119f7783cc4ff00e5bf9bb27850ae7698d4fe8 # timeout=10
Parsing POMs
[BitCalculator] $ /opt/java/6/bin/java -Djava.awt.headless=true -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.5.jar:/usr/share/maven/boot/plexus-classworlds.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/maven /var/lib/jenkins/war/WEB-INF/lib/remoting-2.44.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.5.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 56445
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/workspace/BitCalculator/pom.xml -P sign clean deploy
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:331)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsupportedClassVersionError: javax/inject/Provider : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:86)
... 22 more
channel stopped
[BitCalculator] $ /bin/sh -xe /tmp/hudson6524656470722686910.sh
+ rm 'target/*no_deps*'
rm: cannot remove 'target/*no_deps*': No such file or directory
Build step 'Execute shell' marked build as failure
ERROR: Failed to parse POMs
hudson.util.IOException2: java.lang.reflect.InvocationTargetException
at hudson.maven.Maven3Builder.call(Maven3Builder.java:178)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
... 10 more
Caused by: java.lang.Exception: java.lang.reflect.InvocationTargetException
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:181)
... 15 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:331)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
... 15 more
Caused by: java.lang.UnsupportedClassVersionError: javax/inject/Provider : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:86)
... 22 more
Archiving artifacts
Sending e-mails to: antony#blazrsoft.com
Finished: FAILURE
This indicates that there's Java 7 interfering somewhere, but I'm not sure where.
The code is 1.6 compliant and most of the projects have no dependencies, so I'm not sure why this is happening. If I execute maven outside of Jenkins, the projects build just fine with JDK 6, so its leading me to think there's a misconfiguration in Jenkins somewhere, but I'm not sure where since everything seems to be as it should be. The paths to the JDKs are set properly in the global config and the projects themselves are set to use the specified JDK's. I apologize if its a duplicate question or something silly, but I've been trying to figure this out for days with no results. Everyone just says to check the paths and make sure there are no dependent artifacts built with a later JDK and I'm sure that this is not the problem.
$ mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-16)
Maven home: /usr/share/maven
Java version: 1.8.0_20, vendor: Oracle Corporation
Java home: /opt/java/8/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-openvz-042stab090.5-amd64", arch: "amd64", family: "unix"
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.6</source>
<target>1.6</target>
<compilerVersion>1.6</compilerVersion>
</configuration>
</plugin>
You have an old java version. For example in my case I´m compiling an old product so I have to keep the java deprecated version.
So the solution was to download a newest jdk and configure the JAVA_HOME in the slave.
http://lmarccdk12.ptx.fr.sopra:14000/computer//configure in the section Advanced/JavaPath=/root/jdk1.7.0_79/bin/java (that´s the version I chose)
You will see the following message in the slave launch log:
[SSH] Starting slave process: cd "/root" && /root/jdk1.7.0_79/bin/java -jar slave.jar
Your Jenkins job is of type "Maven project", and this job type has a limitation in that it cannot run a Maven build with a JDK version that is older than the Java version under which Jenkins is run.
Beginning with Jenkins 2.357 (released on June 28, 2022) and the forthcoming 2.361.1 LTS release, Jenkins requires Java 11 or newer. Therefore, you can no longer run Maven projects with JDKs 1.6, 1.7 and 1.8. The minimum version is now Java 11.
To resolve this, you may:
Create a Freestyle project and use Invoke top-level Maven targets to invoke Maven, or create a Jenkins Pipeline project. In both cases, using an older JDK will be possible.
Use JDK 11 but set source and target version to the older Java version. I haven't tried that though, and I believe this option may cause other trouble.
For further information, see also Jenkins requires Java 11 or newer and Maven Builds Fails After Upgrade

java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0

When i try to compile my GWT application i'm getting below exception. Any idea ? Thanks in advance.
Loading inherited module 'widgets.PresentationWidgets'
[ERROR] Unexpected error while processing XML
java.lang.UnsupportedClassVersionError: gwt/widgets/server/datagrid/util/WrapperGenerator : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
clearly, your Java runtime evnironment is different from that of compile time version
For me this solved the problem:
I have a 64-bit system with jdk1.7 (32bit) and jdk1.6 (64 bit) installed. Even though I had specified PATH and JAVA_HOME for jdk1.7, my java -version was 1.6
I removed the folder in which jdk1.6 was installed
. The problem was gone. Apparently, a 64 bit system gave preference to jdk1.6(64bit) instead of jdk1.7(32bit)
For more info, refer: How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

Categories

Resources