How to install JDK 11 under Ubuntu?
To install JDK 11 under Ubuntu, follow these steps:
To install JDK 11 under Ubuntu, follow these steps:
- Install OpenJDK 11, the free and default Ubuntu alternative, by running:
sudo apt update && sudo apt install -y openjdk-11-jdk - Open a terminal and verify the installation directory by running:
update-alternatives --list java - Verify that the full JDK is installed by running:
java -versionandjavac -versionThis should print the version of the JDK that you just installed. - If multiple Java versions are installed, configure the default by running:
sudo update-alternatives --config java - Configure the
JAVA_HOMEenvironment variable by addingexport JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64to your~/.bashrcor~/.profile, then runsource ~/.bashrc(or restart your terminal / runexec bashto apply changes immediately).