In the previous chapter, we learnt how to configure the Jenkins and start the server and see its GUI for other basic configurations. In this chapter will learn about configuring the JDK in Jenkins. Since Jenkins is commonly used for building and deploying the java applications, it offers excellent features for the same.
As a default one, Jenkins will use the java version which it find from the system path. This is which the Jenkins itself running under. However there may be scenarios where there is a need to configure more than one version of the JDK. Consider, in the production system the application might be running on JDK 5 and in some QA platform higher version of the JDK may be required in order to perform some specific tests e.g. performance issues.
As a best practice, it is always advisable to build the applications using the java version which is close to the version used in the production environment. Because, the application developed under JDK 5 can run easily with JDK 6 but the inverse of this may always have a high chance of failure.
Jenkins provides a good feature to configure multiple JVMs in order to overcome the above mentioned inverse java version issue.
Below are the steps to be followed in order to configure the JDK in Jenkins :
NOTE : The Jenkins will validate to check whether the installation directory exists for the specified JDK versions.