<p>Actually looks like I haven't done a great build-setup here. The way to correctly do this is not trying to change the default JDK (even though I still think there's an issue in the Docker..). What really required is a &quot;Tool&quot; section under JDK section for the builds to work with the custom JDK. So the notion from Jenkins, the Agent JDK is what I need, and not to worry about the Controller JDK really.</p>
<p>A great video that I came across that helped:</p>
<p><a href="https://www.youtube.com/watch?v=qx3XK82BZPk" rel="nofollow noreferrer">How to Configure a JDK in Jenkins</a></p>

CC BY-SA 4.0
2022-08-19T22:19:26.437Z
2022-08-20T11:16:21.673Z
2022-08-20T11:16:21.673Z
MaduKan
<p>I installed docker for Jenkins <code>JDK17</code></p>
<pre class="lang-shell prettyprint-override"><code>docker pull jenkins/jenkins:jdk17
</code></pre>
<p>Reason being I run a single node (I know isn't the best practice, but for trying out) and my target application is also a <strong>Java build</strong>.</p>
<p>Now, the issue is when I checked the version in a build, it is still Java <code>9</code> Not <code>17</code>! Results in build failures.</p>
<pre class="lang-shell prettyprint-override"><code>+ java -version
java version &quot;9.0.4&quot;
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
</code></pre>
<p>How can I get <code>JDK 17</code> so that I can build my application using Jenkins Docker?</p>

CC BY-SA 4.0
2022-08-19T19:38:33.203Z
This is probably less of a question and more of a bug that should be reported https://github.com/jenkinsci/docker/issues 
`
But I dont expect this is a bug. What happens if you run `which java`. The java install should be here https://github.com/jenkinsci/docker/blob/d8d4c1146a3ea3464573842b5390802331ed25e5/17/debian/bullseye/hotspot/Dockerfile#L102-L104
Levi
<docker><jenkins><java>
Jenkins JDK17 Docker still using JDK9?
MaduKan
# Jenkins JDK17 Docker still using JDK9?

(Asked by: username_0 on 2022-08-19)

I installed docker for Jenkins JDK17
docker pull jenkins/jenkins:jdk17

Reason being I run a single node (I know isn't the best practice, but for trying out) and my target application is also a Java build.
Now, the issue is when I checked the version in a build, it is still Java 9 Not 17! Results in build failures.
+ java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

How can I get JDK 17 so that I can build my application using Jenkins Docker?

**Tags:** docker, jenkins, java

> **Comments:**
> **username_1**: This is probably less of a question and more of a bug that should be reported https://github.com/jenkinsci/docker/issues  ` But I dont expect this is a bug. What happens if you run `which java`. The java install should be here https://github.com/jenkinsci/docker/blob/d8d4c1146a3ea3464573842b5390802331ed25e5/17/debian/bullseye/hotspot/Dockerfile#L102-L104  

---

## 1 answers

### Answer by username_0 on 2022-08-19. Score: 1

Actually looks like I haven't done a great build-setup here. The way to correctly do this is not trying to change the default JDK (even though I still think there's an issue in the Docker..). What really required is a "Tool" section under JDK section for the builds to work with the custom JDK. So the notion from Jenkins, the Agent JDK is what I need, and not to worry about the Controller JDK really.

A great video that I came across that helped:

[How to Configure a JDK in Jenkins](https://www.youtube.com/watch?v=qx3XK82BZPk)


---

