Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Can We Change Setting In Jenkins As It Picks Desire Version Of Java.

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

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x