Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 413
GeoCom Avatar asked Apr 08 '26 21:04

GeoCom


1 Answers

JDK Tool Plugin in Jenkins only support the automatic download of version up to Java SDK 1.9 so I will write the process made by me in order to config OpenJDK-11(I'm using this specific version but another version can be used) in a Jenkins running in a Docker container:

  1. Login into the host server where the docker container is running using SSH service.
  2. Check the running containers with the command: docker ps
  3. Get in into the Jenkins container with the command(in my case, the container name is "jenkins"): docker exec -it containerName /bin/bash
  4. Download the OpenJDK 11: cd /usr/local && wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz
  5. Unpack the downloaded file: tar -zxvf openjdk-11+28_linux-x64_bin.tar.gz
  6. Now you will have a folder "jdk-11" under /usr/local.
  7. Go to Global Tools Configuration in Jenkins and set up the SDK config like the showed image:

enter image description here

  1. Now you can make use of a different version of Java SDK in Jenkins builds using as label "Java SE 11".
like image 113
hermeslm Avatar answered Apr 10 '26 11:04

hermeslm