Jenkins Java 7 question

1,532 views
Skip to first unread message

robert...@onyxpoint.com

unread,
May 21, 2015, 9:04:38 AM5/21/15
to jenkins...@googlegroups.com
jenkins master: Linux 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

When upgrading from the 1.611 war file with 1.612 and running "service jenkins start" in my shell indicates I need java 7 and I'm running java 6. I see that 1.612 now requires Java 7. However, running "java -version" I see:

java version "1.7.0_65"

How can I fix the discrepancy between which version of Java Jenkins is looking at, and which version of Java my server is looking at? In other words: I want to tell Jenkins to use Java 7, which is already installed on my server. All the java variables under System Properties on my Jenkins page point to Java 6.

Thanks

Mark Waite

unread,
May 21, 2015, 9:44:58 AM5/21/15
to jenkins...@googlegroups.com
The script that is executed by "service jenkins start" is likely explicitly declaring a java version by its path to the java executable.  If you're on a Red Hat derivative, you could look at /etc/sysconfig/jenkins to see if it calls for a specific java version.  If you're on a Debian dreivative, you could look at /etc/defaults/jenkins to see if it calls for a specific java version.

Mark Waite 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/17da5b2e-6153-4015-8a0f-ce3a60362aeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

robert...@onyxpoint.com

unread,
May 21, 2015, 9:53:00 AM5/21/15
to jenkins...@googlegroups.com
Oh interesting thanks.

So the only thing I see in there that MIGHT be close to that is this:

JENKINS_JAVA_OPTIONS="-Djava.io.tmpdir=/var/lib/jenkins/tmp -Djava.awt.headless=true -Djavax.net.ssl.trustStore=/var/lib/jenkins/cacerts.jks -Xmx1024m -XX:PermSize=32m -XX:MaxPermSize=256m"

robert...@onyxpoint.com

unread,
May 21, 2015, 9:56:51 AM5/21/15
to jenkins...@googlegroups.com
That got me thinking though, the jenkins script in /etc/init.d does have a for loop:

for candidate in /usr/lib/jvm/java-1.6.0/bin/java /usr/lib/jvm/jre-1.6.0/bin/java /usr/lib/jvm/java-1.5.0/bin/java /usr/lib/jvm/jre-1.5.0/bin/java /usr/bin/java


Could I add in the path to my java 7 (which does exists)? /usr/lib/jvm/jre-1.7.0/java

Mark Waite

unread,
May 21, 2015, 10:36:42 AM5/21/15
to jenkins...@googlegroups.com
Yes, you need to assure that the JDK 7 java is the first one found by that start script.

robert...@onyxpoint.com

unread,
May 21, 2015, 10:39:42 AM5/21/15
to jenkins...@googlegroups.com
Awesome I will try that. Thanks!

robert...@onyxpoint.com

unread,
May 21, 2015, 11:05:57 AM5/21/15
to jenkins...@googlegroups.com
Mark, thank you so much for the help. That worked. Once I updated /etc/init.d/jenkins like you said, jenkins started when I did "service jenkins start"

satheesh kumar

unread,
May 22, 2017, 2:10:25 AM5/22/17
to Jenkins Users
The below error seems wierd for me:

Jenkins requires Java7 or later, but you are running 1.7.0_141-mockbuild_2017_05_09_14_20-b00 from /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141.x86_64/jre
java.lang.UnsupportedClassVersionError: winstone/Launcher : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at Main._main(Main.java:224)
        at Main.main(Main.java:112)

Can anyone help what is it trying to complain, since it uses java7 already?

Baptiste Mathus

unread,
May 22, 2017, 2:12:41 AM5/22/17
to jenkins...@googlegroups.com
Jenkins requires Java 8, not 7, since Jenkins 2.54. What is the version of Jenkins you're using? Also, seems like you answered an existing thread, please create new ones. This thread was two years old...

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0d840007-7cfb-4ce8-801e-4bb6b4fbf5b0%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages