How To Run Java Program In Command Prompt or cmd
How To Run Java Program In Command Prompt or cmd
Step 1: Open Notepad and type code. Save the file with .java extension
HelloWorld.java

Step 2: Press Key Windows+R to open Run dialog box , type cmd in the dialog box and click ok.


Step 3: Navigate to the folder where you saved the HelloWorld.java file.
file is stored in the E:\java code\ folder.

Step 4: Compile HelloWorld.java file using javac HelloWorld.java Command
compiler compiles the program and create HelloWorld.class file which is executable
code also called Bytecode.


Step 5: Run compiled program using command java HelloWorld

Output :
Step 1: Open Notepad and type code. Save the file with .java extension
HelloWorld.java
Step 2: Press Key Windows+R to open Run dialog box , type cmd in the dialog box and click ok.
Step 3: Navigate to the folder where you saved the HelloWorld.java file.
file is stored in the E:\java code\ folder.
Step 4: Compile HelloWorld.java file using javac HelloWorld.java Command
compiler compiles the program and create HelloWorld.class file which is executable
code also called Bytecode.
Step 5: Run compiled program using command java HelloWorld
Output :
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home