loading...
Cover image for How to install Java 13 from AdoptOpenJDK

How to install Java 13 from AdoptOpenJDK

sandrogiacom profile image Sandro Giacomozzi ・2 min read

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

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

Check if work's

jenv versions

My default (global) Java version is 11.

Test

Create a new directory:

mkdir java-13
cd java-13
java -version

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)

To set Java 13 as local, just type:

jenv local 13

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)

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!

Posted on by:

sandrogiacom profile

Sandro Giacomozzi

@sandrogiacom

Helping Java developers working on enterprise applications to become experts on Java and Devops by practicing the right skills.

Discussion

markdown guide