In this post we will be making a "Hello World" Program by using the command prompt.
(I) Go to Run or press (Windows+R) key .
(II) Type in cmd.
Command Prompt
(III) Type -> cd desktop (so as to move to the desktop subdirectory)
->mkdir Programs (creates a folder Programs on desktop)
->cd Programs
->notepad first.java (creates a file first with.java extension in Programs folder)
(IV) Now copy the following code inside first.java
(V) Go to the cmd and type -> javac first.java
This will compile the first.java and form a sample.class file inside your Programs folder.

(VI) We have the bytecode of the sample class made in first.java now, we will run it .
-> java sample
NOTE: do not include .java while running
We have successfully compiled and run our first program using the command prompt.
(I) Go to Run or press (Windows+R) key .
(II) Type in cmd.
Command Prompt
(III) Type -> cd desktop (so as to move to the desktop subdirectory)
->mkdir Programs (creates a folder Programs on desktop)
->cd Programs
->notepad first.java (creates a file first with.java extension in Programs folder)
(IV) Now copy the following code inside first.java
(V) Go to the cmd and type -> javac first.java
This will compile the first.java and form a sample.class file inside your Programs folder.

(VI) We have the bytecode of the sample class made in first.java now, we will run it .
-> java sample
NOTE: do not include .java while running
We have successfully compiled and run our first program using the command prompt.
No comments:
Post a Comment