How to use two different versions of JDK

We have a Jenkins controller and 3 agents (one of each application). I have multiple pipelines to deploy 3 different Java/J2EE legacy applications. They are not microservices applications. Jenkins & the applications currently uses Java 1.8. We are in the process of upgrading one of the application to Java version 11. How do I run Jenkins on two version of Java (8 & 11)? Can I have Java 1.8 in the controller and Java 11 in an agent?

Hi there,

As a reminder, the term “slave” to refer to an agent has been deprecated since 2016. The term “master” to refer to the controller has been deprecated since 2020. Please refer to On Jenkins Terminology Updates for more details. We request you update your post.

Yes, you can build with a different JDK than is used for the controller or the agent. See the video from Darin Pope at

If the Jenkins job type that is being used is a maven integration job type rather than a Pipeline job or a freestyle job, then you’ll want to convert the job to a Pipeline job. See an earlier answer for more links related to the transition from a maven integration job type to a Pipeline job.

1 Like