


To Run Java from command Line in Linux Just follow the steps:ġst step: With the help of terminal install open JDK using the command “sudo apt-get install openjdk-7-jdk”Ģnd step: Now write the java code in Text Editor and save in the root with filename.java extension.ģrd step: Now compile the program using java compiler javac i.e type javac filename.java in terminal.Ĥth step: Now the new class file has been created.ĥth Step: Now run the java file by typing java classname in the terminal.Ħth Step: Now the output has been displayed on the screen. I never faced any problem using it in Linux. OnlineGDB is the best online compiler that I will personally recommend. There are also online java compilers available. Run Java Program Onlineĭid you know? the java program can also be compiled online. This video covers setting the path of JDK and the process of compiling and running the java program link. In this Youtube video, we have shown how to run the java program in cmd Using Notepad.

java.ģrd Step: Set the path of JDK and locate the file on command prompt.Ĥth Step: compile the file using java compiler command javac yourfilename.java.ĥth Step: After compiling the file run the program using command java classname and press enter.Ħth Step: Now the output is printed on the screen. 1st Step: Type the java code in notepad and save in a specific folder with extension.
