Search code examples
hudsonjenkins

How do I configure starting jdk for hudson(now jenkins)?


I googled a lot and read through the wiki, just could not find out where setting starting jdk can be done. It needs jdk 1.5 or later. The os is centOS and I set the JAVA_HOME environment variable to a 1.6 version and add jdk bin directory into PATH environment variable, when I run the command '/etc/init.d/jenkins start' , I received below error:

Jenkins requires Java5 or later, but you are running 1.4.2 from /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
java.lang.UnsupportedClassVersionError: 48.0
   at Main.main(Main.java:90)

Don't know why jenkins look for jdk from path above, I don't see any environment variable containing /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre. Any ideas?

========update
to firelore:

I tried to run command 'update-alternatives --install java java /home/irteam/app/jdk1.6.0_07 ',it doesn't work,prompting command parameters, like :

alternatives version 1.3.30.1 - Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage: alternatives --install <link> <name> <path> <priority>
                    [--initscript <service>]
                    [--slave <link> <name> <path>]*
       alternatives --remove <name> <path>
       alternatives --auto <name>
       alternatives --config <name>
       alternatives --display <name>
       alternatives --set <name> <path>

common options: --verbose --test --help --usage --version
                --altdir <directory> --admindir <directory>

Solution

  • The 1.4.2 version was bundled with your centOS install and made default. You will need to run the update-alternatives command to change your symlink to your updated jdk location.