Search code examples
javajenkinsjenkins-plugins

Using OpenJDK 12 in Jenkins (Docker version)


I tried to install OpenJDK 12 in jenkins, with *.tar.gz installer but i get the error Cannot run program "/bin/java"

JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/java12

Note I created the directory "hudson.model.JDK" myself.

here is the tool configuration enter image description here

full error log enter image description here


Solution

  • JDK 12 has one bug logged https://bugs.openjdk.java.net/browse/JDK-6746185 according to this Malformed URL is invalid, So jenkins is not able to download JDK

    Simple solution is download JDk from this link, or whatever you like and add Open JDK in jenkins as I do

    https://download.java.net/java/GA/jdk12.0.1/69cfe15208a647278a19ef0990eea691/12/GPL/openjdk-12.0.1_linux-x64_bin.tar.gz

    Download JDK and extract it to one folder.

    Manage Jenkins> Global Configurations> Add JDK>
    1. Name: Open JDK(Or whatever you want) 2. JAVA_HOME: \Open_JDK\

    like in my case E:\Open_JDK\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2

    enter image description here

    in jenkins

    enter image description here

    Save and exit, everything working fine

    Happy Jenkins, Happy to help