First thing’s first, you need what is called a Java Systems Development Kit (SDK). You can find many different SDK’s on the net, but the one that you should use is any of the SDK’s from Oracle site .

After you’ve installed the program, you have two options, go to > Developer Tools > Tools and Editors and download TextPad to easily create your programs without anything more to do. Here, you can create, save, and compile all of your programs without configuring your computer.

You can also take the hard way and find and open your MS-DOS prompt to set the program to your computer. You should be able to find it by clicking “Start”, then go to “Programs”, and finally scroll down until you find “MS-DOS Prompt”, or click “Start”, then go to “Accessories” and scroll down until you find “MS-DOS Prompt”. You can also click “Start”, then click “Run”, then type “command” in the search box. Then type path = c:\sdk1.4.2\bin to let your computer know that this is where you are going to be working from. If your DOS has anything more than C:\> (like: C:\WINDOWS\DESKTOP\>), type cd.. to change the directory to your root directory (C:\>).


This is what you need to do EVERYTIME you want to work with Java (NOTE: If you have a text editor that allows you to compile Java, you may omit this step). If you have a special folder that you want to save your work in (i.e. a folder called Java), you need to type cd Java to compile and run your programs. Otherwise, you’ll receive the error message can’t find program “” 1 error.

READ  Creating programs - Java Tutorial

Now that the hard part is out of the way, let’s start working. Open up Notepad (or your text editor) and type the text you see below:

public class First
public static void main(String[] args)
System.out.println("This is my first Java Program!!!");

Now, go click File, click Save as, type “” (or just First if you’re using TextPad) in the File name: box, and make sure it says Text Documents (or *.java in TextPad) in the Save as type: box. Also, make sure you are saving it to the right place (or folder). Here’s the moment you’ve been waiting for: switch to your DOS prompt and type javac (or go to Tools > Compile Java in TextPad). If just your prompt comes up, it compiled. If not, and you get an error message, check to see if you did everything correctly. Then, type java First (Tools > Run Java Application in TextPad). You should get the message: This is my first Java Program!!!

Rather than using a notepad, there is a easy way to do this using tools. The above mentioned method will help you to understand how java works.  You can use Eclipse or any other editor so that the complexity mentioned above can be avoided and you run the program with a button click.