Issue with Jenkins Java version please advise

Hi Team,
Good Morning, We have installed Jenkins latest version with Java 17. Tring to execute shell script on remote server via SSH connection with pipeline scripts.

Agent is not connecting the Remoteserver because of java used on remote server is Java8 and on Jenkins is installed with Java17, I am able to connect agent on local server where Jenkins installed ( java17)

[10/25/24 09:33:02] [SSH] Starting agent process: cd “/home/ofsaailx/agent” && java -jar remoting.jar -workDir /home/ofsaailx/agent -jar-cache /home/ofsaailx/agent/remoting/jarCache
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

Option 2:

Installed Jenkins version supported for Java 8 on remote server jenkins-2.164.3 but after installation all the plugin’s are failed and asking to upgrade " You must update Jenkins from version 2.164.3 to version 2.387.3 or later to run this plugin"
we have an issue here as per the documents of supported versions version 2.387.3 is not compatible with Java8 on remote server and we can’t upgrade version because remote server applications are only works on Java8 to execute these shell scripts commands.

2.419 (August 2023) and newer

Java 11, Java 17, or Java 21

2.357 (June 2022) and newer

Java 11 or Java 17

Request you please advise if you have any fix to overcome these issues. Thank you in advance.

When you use Jenkins 2.357 or newer then you must also use at least Java11 on your agents. Starting 2.463 you will need at least java 17 on the controller and your agents. If you build process still needs java8 then you need to install both java8 and java17 on your agent and configure it accordingly so the agent process uses java17 and the build process uses java8
You should not use such old Jenkins versions like 2.164.3 as it has several security issues.

Hi Markus, Thank you for your reply. Sure i will try to install do you have any document how to configure these 2 different Java version on Jenkins agent server please share.

thanks
Dilip

Refer to the answer and the tutorial video at: