You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04.4安装Jenkins后无法启动:Java版本不符求助

Jenkins Startup Failure on Ubuntu 18.04.4: Fixing Incorrect Java Version Issue

First off, your installation steps are mostly applicable to Ubuntu 18.04.4—but you missed a critical step: setting Java 8 as your system's default Java runtime. That's why Jenkins is still detecting Java 10 (which older stable Jenkins versions don't support) and failing to start.

The Root Cause

From your logs, the issue is crystal clear:

Found an incorrect Java version
Java version found:
openjdk version "10.0.2" 2018-07-17

Even though you installed Oracle Java 8, your system hasn't switched to using it by default. Jenkins relies on the system's default Java executable, so it's picking up Java 10 instead of the 8 you installed.

Step-by-Step Fix

  1. Confirm Java 8 is installed on your system:
    Run this command to list all available Java versions:

    update-alternatives --list java
    

    You should see a line pointing to Oracle Java 8 (e.g., /usr/lib/jvm/java-8-oracle/jre/bin/java).

  2. Set Java 8 as the default runtime:
    Run this command and select the number corresponding to Java 8 when prompted:

    sudo update-alternatives --config java
    

    Repeat the same for the Java compiler to ensure consistency:

    sudo update-alternatives --config javac
    
  3. Verify the default version:
    Check that Java 8 is now the system default:

    java -version
    javac -version
    

    Both outputs should show Java 8 (Oracle or OpenJDK) instead of 10.

  4. Restart Jenkins and check its status:

    sudo systemctl restart jenkins
    sudo systemctl status jenkins
    

    Jenkins should now start successfully without the version mismatch error.

The webupd8team/java PPA is no longer maintained, so using OpenJDK 8 (officially supported in Ubuntu's base repositories) is a more stable approach:

  • Uninstall Oracle Java if needed:
    sudo apt remove oracle-java8-installer
    
  • Install OpenJDK 8:
    sudo apt install openjdk-8-jdk
    
  • Follow steps 2-4 above to set it as default and restart Jenkins.

Content of this question is sourced from Stack Exchange, asked by Mornon.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:39:36