- Add repository "sudo add-apt-repository ppa:openjdk-r/ppa"
- Run "apt update" command to update libraries
- Install by running "sudo apt install openjdk-7-jdk"
- Run "java -version" to check the installation. It should print as below
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-3)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
- To create a hello world program, run "nano HelloWorld.java"
- On the opened editor paste the program and save it
- Run "javac HelloWorld.java" to compile the code
- Run "java HelloWorld" to see the "Hello, World" result