JAVA_HOME | Kindly Help

Hey, is it possible to add java 11 path and java 17 path against JAVA_HOME , under system JAVA_HOME /usr/lib/jvm/java-11-openjdk-11.0.22.0.7-2.el8.x86_64
JAVA_HOME /usr/lib/jvm/java-11-openjdk-17*.el8.x86_64

i have both java 8 code and java 17 code in my jenkins machine, for compiling java 8 we are using java 11 , for compiling java 17 we are using java 17 itself, so i need to know is it possible to use 2 JAVA_HOME in same jenkins machine

Should be possible though there are many way how you can achieve your requirement to be able to build with different Java version. You just need to ensure that Jenkins and its agents have the correct Java. But neither controller nor agents rely in JAVA_HOME normally. All they need is the correct Java to be in the path. In the actual build you can just set JAVA_HOME and PATH so they point to the desired Java version. Or you can define separate agents for different Java versions

A video from Darin Pope may help: