Since the amazon-linux-extras
repository supports the OpenJDK 11 package, the installation of Java 11 on Amazon Linux 2 is literally one simple command. Let’s reveal the magical command.
Prerequisites
- Amazon Linux 2
- sudo privileges
Install Java 11 on Amazon Linux 2
Step 1. To install Java 11 on Amazon Linux 2, run:
sudo amazon-linux-extras install java-openjdk11
Step 2. Verify the installation.
java -version
Step 3. If you have multi-java environment, and you want to switch the java version, run:
alternatives --config java
Conclusion
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.