Things You'll Need:
- Internet access
- Administrator access to your computer
-
Step 1
Download the latest Java software developer's kit from Sun Microsystems and install it on your computer.
-
Step 2
Open a text editor for writing your first program. All Java program source code is saved with the default file extension .java. Save the blank document as myFirstProgram.java
-
Step 3
The first program that most students learn in any program is called "Hello World." The primary purpose of the Hello World program is to ensure that the student can create a basic program in the language being taught and display the words "Hello World" to the console or screen of the development computer. To create "Hello World" in Java, type the following code into the text editor and save the file.
class myFirstProgram
{
public static void main (String[] args)
{
System.out.println("This is my first computer Program! Hello World!");
} // end of the main method
}// end of class myFirstProgram -
Step 4
Open your command prompt on a Windows computer by selecting the Start->Command menus and enter the letters "cmd" or "command" to open the command prompt. Change the directory to where you saved the myFirstProgram.java file. Type the command "javac myFirstProgram.java" and hit the "enter" key. This will create the byte code that will be run in a new file called myFirstProgram.class.
-
Step 5
Run the new Java program by typing "java myFirstProgram.class" on the command line. The following output will be displayed at the command prompt: "This is my first computer Program! Hello World!" and your first computer program is complete.



















