Jenkins docker agent failure due to Java Runtime version

I upgraded Jenkins recently to the latest LTS version with Java 1. I am using a Docker container for the Jenkins build. Still some Docker images are using Java 1.8.0 since it is our internal application dependency. But it seems Jenkins is expecting Java 11 on the Docker image.

Is there any way to fix the below error?

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

Jenkins does require at least Java 11 for the controller and agent processes. This does not mean that you cannot build your projects that require Java 8. You would need to have Java 11 and Java 8 installed in your docker image and have Java 11 be the default for running the agent.jar file.

1 Like