Configure Java 8 node in a Java 11 Jenkins Server

Jenkins setup:
Version 2.426.2
Installation followed this page: Linux

My Jenkins server has a Java 11 version and my applications run using openJDK-8.

I am trying to create a node from a docker container that uses a custom image. My Dockerfile uses as base image the jenkins/ssh-agent:latest-jdk8.

When I setup the node and launch the agent, I am getting the error below:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher 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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
Agent JVM has terminated. Exit code=1

So, my question is: Is it possible to launch a java 8 node into a java 11 jenkins server? If yes, can someone give how can I do this configuration?

Thank you.

the agent java process must be java 11, but nothing stops you from installing also jdk8 on your agent and make sure that your build process is using jdk8

1 Like

Thanks. I was able to run the node with java 11 and then run pipelines using java 8.