go to previous page   go to home page   go to next page



Step 5: Save the Program

The next step is to save the text in Notepad to a source file.

save as

You will have to "navigate" to the default subdirectory of the command prompt window (see step 2). You will get a window that allows you to navigate to the subdirectory where the file should be saved.

For this example, the subdirectory is C:\Temp. If you see this directory, click on it. (If you don't, use the various controls to move around until you do see it.) There will probably be miscellaneous strange files in this directory, but they don't hurt.

The file should be given the name that is the same as the class that contains the "main" method. Our first programs will contain only one class, so use that class name. The last part of the file name should be .java (don't forget the period.) Here is the start of this step:

Name the File

Type in the name of the source file:


in the "File Name" text box. Now Select "All Files" in the "Save as Type" text box. Finally, click on the "Save" button.

Warning (1): In some versions of Notepad you must use quote marks around the name of the file. So in the above you would type "HelloPlanets.java" (quotes included) into the File name box.

Warning (2): Be sure that you Save as type All Files

Warning (3): Be sure that you pick Encoding ANSI


Hopefully, the file HelloPlanets.java has been saved to the subdirectory C:\Temp, the same one that the command prompt window is using. How can you confirm that this indeed happened?