Step 3: Creating a Simple Java Program

Create Program
1. Go to Start pane>All Programs > Accessories> Notepad.exe
2 Copy and paste the following exactly:
public class helloworld
public static void main(String[] args)

System.out.println("Hello World!");

3. a.Save file as: helloworld.java 
     b.Make sure "save as type" under where you typed the file name as "All Files" (as opposed to the default "Text-File").
      c. You want to save your java file where  the Command Prompt  is set to open at.*

*Such as C:\Users\MyUserName 
<p>I have a problem with step 4, it just says &quot; 'javac' is not recognized as an internal or external command, operable program or batch file</p>
<p>please help me :(</p>
<p>Hello guys,</p><p>I am new for java. I tried one small java program with the help of this blog.but i am stuck on compiling step and getting error saying file not found.</p><p>Please anyone correct me.</p><p>Regards,</p><p>Sup</p>
<p>Wonderful! I have been scouring the internet trying to figure this out without screwing stuff up. Thank you for making it so clear.</p>
<p>Hi, the tutorial has been really helpful, I have some questions, though:</p><p>1. Why do we have to type &quot;set Path=C:\Program Files\Java\jdk1.6.0_21\bin&quot; and &quot;set Path=C:\Program Files\Java\jdk1.6.0_21\bin&quot;? I tried just typing either one and it compiled just fine</p><p>2. Is there any difference between &quot;set Path=C:\...&quot; and &quot;set PATH=%PATH%;C:\...&quot; (besides the syntax)?</p><p>Thanks in advance :)</p>
In cmd javac myprogramme.java,it takes few sec and there is no error but in cmd java myprogramme,there is a msg shown is- <br>Error:Could not find or load main class myprogramme <br> <br>plz tell me how short out this prob?? <br>
<p>Truely great................. Thats all i want to say</p><p>works 100%....</p>
<p>This works 100% fine. Thanx for adding it on net.</p>
with these we have to take care of the spell and case of the class

About This Instructable


10 favorites


More by James Russell: Programing with Java using Command Prompt
Add instructable to: