Machine Executor with JDK 11

I have an application that uses JDK 11 and this application also uses a docker library (Testcontainer) for testing and I therefore need to use the Machine type executor.
The default ubuntu image for machine type runs on JDK8.

Is there already a new Ubuntu image with JDK 11 installed or how can I achieve this?

Hi @chemika,

Welcome to the CircleCI community!

I would suggest using the new ubuntu-2004:202008-01 machine executor image, already available for early preview. It comes with OpenJDK 11 as the default version.

However, I strongly advise you to read this post before deciding to use that new image.

Alternatively, you could keep using the ubuntu-1604:202007-01 machine image and upgrade OpenJDK to version 11, as follows:

version: 2.1

      image: ubuntu-1604:202007-01
      - run:
          name: Install OpenJDK 11
          command: |
            sudo apt-get update && sudo apt-get install openjdk-11-jdk
            sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
            sudo update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
            java -version
      - build

@yannCI Thanks …This was really helpful…

1 Like

is there an image for jdk-17?

now there is: Ubuntu Linux VM (machine) Images - 2022 April (Q2) Update

1 Like

awesome! thank you for tagging me in here