How to install java using Linux command

How to install java using Linux command

1.Update the package index:
sudo apt-get update
2.Install Java:
For Java 11:
sudo apt-get install openjdk-11-jdk
For Java 8:
sudo apt-get install openjdk-8-jdk
3.Verify the installation by checking the Java version
java -version

Leave a Reply

Your email address will not be published.