Namit created the topic: Can we change setting in Jenkins as it picks desire version of Java.
In my Linux server i do have two version of Java (Java 1.6 and Java 1.8), few applications which are running on this server is using Java 1.6, so i cann’t change this setting but i want when i start jenkins service it should pick java 1.8 instead of java 1.6 as for jenkins Java 7 or more is require. Is there any way to fix this problem.
[root@rpc1372 run]# ls -l /usr/bin/java
lrwxrwxrwx 1 root root 30 Jun 15 2014 /usr/bin/java -> /usr/java/jdk1.6.0_19/bin/java
[root@rpc1372 run]# java -version
java version “1.6.0_19”
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Client VM (build 16.2-b04, mixed mode, sharing)
rajeshkumar replied the topic: Can we change setting in Jenkins as it picks desire version of Java.
There are basically 2 way –
Method 1: Modify the “jenkins” file under /etc/init.d
[root@chef-server init.d]# pwd
/etc/init.d
[root@chef-server init.d]# more jenkins | grep -i java
# Search usable Java. We do this because various reports indicated
# that /usr/bin/java may not always point to Java >= 1.6
/etc/alternatives/java
/usr/lib/jvm/java-1.6.0/bin/java
/usr/lib/jvm/jre-1.6.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/bin/java
[ -x "$JENKINS_JAVA_CMD" ] && break
JENKINS_JAVA_CMD="$candidate"
JAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"
daemon --user "$JENKINS_USER" --pidfile "$JENKINS_PID_FILE" $JAVA_CMD $PARAMS > /dev/null
Method 2: Start jenkins using the java which you want manually
. Follow this article
wiki.jenkins-ci.org/display/JENKINS/Star…nd+Accessing+Jenkins
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals