TL;DR It is recommended to use SDKMAN when building a Java environment on Ubuntu. It is possible to install Java via apt, but it is difficult to select and switch versions by yourself. In addition, tools such as gradle require time and effort such as adding a repository. With SDKMAN, you can easily install multiple versions of Java (and Java-related tools) and switch between versions.
Follow the Official Site Installation Procedure.
First, execute the following command. SDKMAN will be downloaded and installed.
curl -s https://get.sdkman.io | bash
After the installation is complete, open a new terminal and pass the path to SDKMAN with the following command.
(You only need to execute it once. There is no need to describe it in .bashrc etc.)
source" /home/username/.sdkman/bin/sdkman-init.sh "
Use the following command to check if the installation was successful. If the version is displayed, the installation is successful.
sdk version
First, check the Java that can be installed with the following command.
sdk list java
Install as follows. (Example: Install Java 11 (LTS) of Adopt OpenJDK)
sdk install java 11.0.9.open-adpt
If you want to install another version of Java, install it in the same way.
sdk install java 14.0.2.hs-adpt
Java tools such as Ant, Maven and Gradle can also be installed with SDKMAN.
For example, when installing Gradle, install it with the following command like Java.
sdk list gradle
sdk install gradle 6.8
-Manage multiple JDKs with SDKMAN
Recommended Posts