- If you don't have JDK in your system, then first you need to download and install Java Development Kit.
- Instructions to DOWNLOAD and INSTALL JDK.
Instructions for Executing the Java Program.
- Locate the class in which the main() function is present.
- Save the program in the name of the class with an extension (*.java). In this example the progm should be saved as ‘Test.java’.
- Open the cmd [Command Prompt] and set the address of the saved progm.
- Type ‘javac <file_name>’ –enter. [e.g.: javac Test.java] If any errors are there, that will be displayed here.
- After correcting all the errors, Save the progm again and compile.
- Now type ‘java <file_name_without_extention>’ [e.g.: java Test ].
- Your program is now executed.