启动的时候,提示存在不正确的 java1.7 版本,但我的版本是 1.8 啊,什么鬼,启动不起来
root@root-59:~$ ps -ef|grep jenkins
root 25034 1931 0 11:26 pts/17 00:00:00 grep --color=auto jenkins
root@root-59:~$ sudo service jenkins start
[sudo] password for root:
Found an incorrect Java version
Java version found:
java version "1.7.0_171"
OpenJDK Runtime Environment (IcedTea 2.6.13) (7u171-2.6.13-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.171-b02, mixed mode)
Aborting
root@root-59:~$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
root@root-59:~$
find出来一个1。7版本的jdk,但我默认的还是1。8啊
jenkins日志:
1
UndefinedDiary 2018-05-12 11:34:38 +08:00 via Android
Jenkins 什么版本的??去官网看看依赖的 jdk 需要那个版本。。。
|
2
wsds OP @UndefinedDiary 前 2 天还运行的好好的,不知道怎么停了,然后就启动不了了,应该不是版本问题吧
|
3
defunct9 2018-05-12 11:45:34 +08:00 via iPhone
开 ssh,让我上去看看
|
5
UndefinedDiary 2018-05-12 11:59:56 +08:00 via Android
@wsds 有多个 jdk ?!
|
6
mringg 2018-05-12 12:07:47 +08:00 via iPhone
因为你用 sudo 了 搜下 sudo 环境变量 了解一下
|
7
wanghanlin 2018-05-12 12:31:56 +08:00
用 docker 的,省力
|
8
wsds OP @UndefinedDiary 目测至少有 2 个
|
10
qinxi 2018-05-12 12:55:21 +08:00 via Android
卸载 openjdk,结帖
|
11
privatezcoding 2018-05-12 13:03:22 +08:00
设置一下 Java 的环境变量试试看
|
12
carlclone 2018-05-12 13:04:53 +08:00 via Android
关机睡觉,结贴
|
13
zqcolor 2018-05-12 13:13:02 +08:00
试试下面几个命令选择 java 8
https://askubuntu.com/questions/315646/update-java-alternatives-vs-update-alternatives-config-java sudo update-alternatives --config java sudo update-alternatives --config javac sudo update-alternatives --config javadoc |
14
wsds OP @zqcolor 没用啊
root@root-59:~$ sudo update-alternatives --config java [sudo] password for root: There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java Nothing to configure. root@root-59:~$ sudo update-alternatives --config javac update-alternatives: error: no alternatives for javac root@root-59:~$ sudo update-alternatives --config javadoc update-alternatives: error: no alternatives for javadoc |
16
qkline 2018-05-12 14:01:17 +08:00
明显是 openjdk 搞的鬼,卸载就行了
|
17
sutra 2018-05-12 14:06:14 +08:00
root@jenkins:~ # grep java_home /usr/local/etc/rc.d/jenkins
# jenkins_java_home (str): : ${jenkins_java_home="/usr/local/openjdk8"} java_cmd="${jenkins_java_home}/bin/java" |
19
vjnjc 2018-05-12 17:18:17 +08:00 via Android
Jenkins 的用户和你不是同一个,所以你们的环境也不一样,所以他用 Java7,你用 Java8
|
20
kaneg 2018-05-12 22:48:44 +08:00 via iPhone
因为系统环境的千差万别,这种 Java 多版本引起的问题很常见,所以用 docker 这种专门解决环境差异的方案是终极解决之道
|
21
zhantss 2018-05-12 22:52:34 +08:00
安装版的 jenkins,默认是创建了一个 jenkins 用户,改这个用户的配置就行
防止发生意外可以改 /etc/default/jenkins 里面的设置,不一定是这个位置,你可以查一下对应软件包的配置文件位置 |
22
tedzhou1221 2018-05-13 02:26:50 +08:00 via Android
Docker Jenkins 更方便,哈哈
|
23
zqcolor 2018-05-13 13:03:30 +08:00
那就卸载这个 openjdk7
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 然后安装 jdk 8 试试 |
24
wsds OP @zhantss 有这个文件,要改什么内容啊
# defaults for Jenkins automation server # pulled in from the init script; makes things easier. NAME=jenkins # arguments to pass to java # Allow graphs etc. to work even when an X server is present JAVA_ARGS="-Djava.awt.headless=true" #JAVA_ARGS="-Xmx256m" # make jenkins listen on IPv4 address #JAVA_ARGS="-Djava.net.preferIPv4Stack=true" PIDFILE=/var/run/$NAME/$NAME.pid # user and group to be invoked as (default to jenkins) JENKINS_USER=$NAME JENKINS_GROUP=$NAME # location of the jenkins war file JENKINS_WAR=/usr/share/$NAME/$NAME.war # jenkins home location JENKINS_HOME=/var/lib/$NAME # set this to false if you don't want Jenkins to run by itself # in this set up, you are expected to provide a servlet container # to host jenkins. RUN_STANDALONE=true # log location. this may be a syslog facility.priority JENKINS_LOG=/var/log/$NAME/$NAME.log #JENKINS_LOG=daemon.info # Whether to enable web access logging or not. # Set to "yes" to enable logging to /var/log/$NAME/access_log JENKINS_ENABLE_ACCESS_LOG="no" # OS LIMITS SETUP # comment this out to observe /etc/security/limits.conf # this is on by default because http://github.com/jenkinsci/jenkins/commit/2fb288474e980d0e7ff9c4a3b768874835a3e92e # reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file |
26
wsds OP |
27
zqcolor 2018-05-15 10:31:51 +08:00
网上查的,可以试试看
https://stackoverflow.com/questions/49367311/start-jenkins-with-jdk-8-without-changing-system-java-home Set JENKINS_JAVA option in /etc/sysconfig/jenkins file. The variable name might be different depending on your operating system and package source but the /etc/sysconfig/jenkins file is usually the configuration file for your jenkins service. |
28
wsds OP 还是不行啊
|
29
RX03 2020-01-14 15:20:31 +08:00
两年了。。。
我自己这样暴力设置可以起来 1. cd /etc/init.d 2. sudo vim jenkins 3. 注释掉 PATH 部分,因为之前编译多个版本的 AOSP,java 环境乱的压批,在 /etc/profile 里 export 了,在这里直接加上 source /etc/profile ubuntu@linux:/etc/init.d$ ./jenkins -> Correct java version found 最后,docker 大法好 |
30
TreePu 2020-12-04 16:37:32 +08:00
1,安装 jdk1.8
|
31
TreePu 2020-12-04 16:41:09 +08:00
1,安装 JDK1.8:sudo apt-get install openjdk-8-jdk
2,切换 JDK 版本:sudo update-alternatives --config java 输入数字,Enter 3,修改 Jenkins 配置文件的 PATH 为 1.8 的路径 sudo vi /etc/init.d/jenkins ## PATH=/bin:/usr/bin:/sbin:/usr/sbin 旧的 PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin/java 新的 4,重启 Jenkins,成功 今天遇到了,把解决过程分享一下 |