2 Minutes To Code (β Version)

'java' command - 2 minute tutorial

Basic Usage : How to use java comamnd to run a java program

The image below shows basic usage of the java command.

If your java command is in the system path (i.e. $JDK_HOME/bin or $JRE_HOME/bin is added to environment variable PATH ), then just open a command prompt (on windows) or shell (on linux), cd to the folder that contains the class you want to run (say HelloWorld.class ), type java HelloWorld and hit enter.

And that is all. Your program will run now. If it prints anything on the standard output (i.e on the console using Syste,.out.println(...)), then you can see that on the console.