I have a VM with Ubuntu 18.04 with JDK 12 as default java in it. I want to setup a Jenkins server on it and as it do not support JDK 12 yet, i have installed JRE 8 in it to support Jenkins.
How to configure Jenkins such that it will use this JRE8 instead of JDK12??
1 Answer
After understanding how Jenkins allows us to override configuration and debugging init script, i found multiple ways to tackle this situation.
Override PATH variable in /etc/default/jenkins(I prefer this solution) PATH=<PATH to your JAVA>
Modify PATH variable in /etc/init.d/jenkins(prefix your path to java) PATH=<PATH to your JAVA>:/bin:/usr/bin:/sbin:/usr/sbin
Force Jenkins to use Java that you specify in /etc/init.d/jenkins JAVA='<PATH to your JAVA>/java'
Note: <PATH to your JAVA> is an absolute path to your java location For E.g. 1. /usr/lib/jvm//bin in case of JDK 2. /usr/lib/jvm//jre/bin in case of JRE