DEV Community

Cover image for How to install Java 13 from AdoptOpenJDK
Sandro Giacomozzi
Sandro Giacomozzi

Posted on

2 2

How to install Java 13 from AdoptOpenJDK

Introduction

In this tutorial, you will learn how to install Java 13 from AdoptOpenJDK project.

AdoptOpenJDK

AdoptOpenJDK provides rock-solid OpenJDK binaries for the Java ecosystem and also provides infrastructure as code, and a Build farm for builders of OpenJDK, on any platform.

Install

To install, just copy and paste the script above in your linux terminal

wget https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13%2B33/OpenJDK13U-jdk_x64_linux_hotspot_13_33.tar.gz
sudo tar xvf OpenJDK13U-jdk_x64_linux_hotspot_13_33.tar.gz --directory /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-13+33/bin/java 2
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-13+33/bin/javac 2
Enter fullscreen mode Exit fullscreen mode

Jenv

To use Java 13 without compromising your current installation, simply use Jenv. Take a look at this post if you don't know the project yet:

https://dev.to/sandrogiacom/multiple-jdks-no-problem-1knc

Add Java 13

jenv add /usr/lib/jvm/jdk-13+33
Enter fullscreen mode Exit fullscreen mode

Check if work's

jenv versions
Enter fullscreen mode Exit fullscreen mode

My default (global) Java version is 11.

Test

Create a new directory:

mkdir java-13
cd java-13
java -version
Enter fullscreen mode Exit fullscreen mode

As expected, the console displayed the global version.

λ java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)
Enter fullscreen mode Exit fullscreen mode

To set Java 13 as local, just type:

jenv local 13
Enter fullscreen mode Exit fullscreen mode

And type java -version again:

λ java -version
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment AdoptOpenJDK (build 13+33)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13+33, mixed mode, sharing)
Enter fullscreen mode Exit fullscreen mode

The complete source code it's on github:

https://github.com/sandrogiacom/dev-scripts

Conclusion

In this short tutorial, we learned how to install Java 13 from AdoptOpenJDK project.

Enjoy!

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more