How To Compile And Run Java Program In Ubuntu Linux

How to compile and run a java program using openjdk on ubuntu GNU linux.

1) Open the terminal using Ctrl-Alt-t

2) Install open JDK by typing
sudo apt-get install openjdk-8-jdk

3) Enter the name of the text editor followed by the name of the file:

4) Type in the program and save

5) Enter javac to compile the program

6) Finally enter java followed by the class which contain the main function to run the program
java ClassName

How to Compile…

Leave a Reply

Your email address will not be published. Required fields are marked *