Running a Java Program from Command Prompt!

A Place For Programmers Of All Levels To Discuss Programming & Web Building.

Moderator: Community Moderator

Post Reply
User avatar
ChattChitto
Site Admin
Site Admin
Posts: 13868
Joined: 20 Aug 2009, 06:20
Status: The Don
Location: The Fourth Dimension
Has thanked: 11 times
Been thanked: 38 times
Contact:

Running a Java Program from Command Prompt!

Post by ChattChitto »

When some of you will start Java Programming the first step should be using our old friend Notepad!
after writing the code and saving it as .java you'll have to compile it.
here comes the command prompt!

How to Compile It:
Click Start > Run > cmd > Brwose to the folder where the .java file exist > Write javac filename.java
and the source file should be compiled! if an error occurred saying that it can't be found or unknown.. then you'll have to modify your System Path!

How to Do That?
In Windows XP go to Control Panel > System > Advanced tab > Environment variables > In the lower list "System variables" click on Path as shown below:
Image

Click "Edit" and at the end append
;C:\Sun\SDK\jdk\bin
(or the path to the appropriate folder where the latest version of JDK is installed on your computer).
NOTE: Do not put spaces before the appended path string.

Click OK on the path edit box and OK on the Environment Variables box. The new setting will go into effect next time you run Command Prompt.
To err is human, to forgive is divine
We can't all be heroes, because somebody has to sit on the curb and applaud when they go by.

ChattChitto RG - Apps Upload List: http://chattchitto.com/forum/viewtopic.php?f=29&t=104
ChattChitto RG - Movies Upload List: http://chattchitto.com/forum/viewtopic.php?f=29&t=5092
ChattChitto RG - Music Upload List: http://chattchitto.com/forum/viewtopic.php?f=29&t=34836
Post Reply

Return to “Programming/Web Building Chat & Support”