0

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: http://www.24k.com.sg/blog-29.html
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH JAVA_HOME CLASSPATH
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-2.3.9.1.el5_9-x86_64)
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 -Djava.io.tmpdir=/var/lib/jenkins/tmp -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... https://serverfault.com/questions/507885/cant-install-jenkins-on-centos#comment571671_507885 any help would be appreciated ;)

1

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
  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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