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.