How to run java program in cmd
prepare and compile
You have to create a java class that contains a main method:
public static void main(String args)
You need to compile your class to execute it:
This command generates a YourMainClass.class file that can be executed.
run the java class
The Java Runtime should be installed and accessible from your terminal.