Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an issue with a VPS, centos, thats running WHM as the container. I need to run open-jdk to get jenkins ci going, but the issue is that oracle's java keeps popping up. From a server restart:

root@host [~]# java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)

and my system:

root@host [~]# cat /etc/*release*
cat: /etc/lsb-release.d: Is a directory
CentOS release 5.9 (Final)

My $PATH points to /usr/local/jdk/bin:/usr/kerberos/sbin:/us... which is where oracle java is located. So my quick-fix solution is to add the openjdk to /etc/profile and call source /etc/profile at every restart. This is what I've added to /etc/profile:

#as per:
export PATH=${PATH/\/usr\/local\/jdk\/bin:}
#end as per

Now java -version returns the openjdk, but javac -version is not found!:

root@host [~]# java -version
java version "1.7.0_19"
OpenJDK Runtime Environment (rhel-
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
root@host [~]# javac -version
-bash: javac: command not found

Also even though java -version returns open jdk when I look at the csf access logs I can see that jenkins is still calling the oracle jdk.

root@host [~]# service jenkins reload
Shutting down Jenkins                                      [  OK  ]
Starting Jenkins                                           [  OK  ]

csf ldf log, notice that its still calling oracle java /usr/local/jdk1.6.0_37:

May 17 07:32:30 host lfd[4392]: *User Processing* PID:4324 Kill:0 User:jenkins VM:802(MB) EXE:/usr/local/jdk1.6.0_37/bin/java CMD:/usr/local/jdk/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --ajp13Port=8009 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20 --prefix=/jenkins --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/log/jenkins/access_log

Getting open-jdk working with jenkins is step one for getting this issue solved... can't install jenkins on centOS any help would be appreciated ;)

share|improve this question
up vote 1 down vote accepted

I assume you have installed java-1.7.0-openjdk-devel. If you still can't don't have to javac in the path, then use update-alternatives to configure it:

 # update-alternatives --config javac

In case of java7 link is missing, add it:

 # update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/javac 1
share|improve this answer
cheers for the your help... the java*-devel package wasn't installed, i've installed it now but the problem still persists. java -version gives java version "1.6.0_37" and javac -version gives javac 1.6.0_37. If I run source /etc/profile then (see op) the /usr/local/jdk/bin: is removed from my $PATH. But server restart puts /usr/local/jdk/bin: back. Also there is no option for the sun-jdk in update-alternatives and update-alternatives always says that open-jdk is set – Daithí May 17 '13 at 7:46
you can enforce different java by defining JENKINS_JAVA_CMD in /etc/sysconfig/jenkins – kofemann May 17 '13 at 8:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.