-
Step 1
Setup a Java development environment on your computer by downloading the latest Java software developer's kit from Sun Microsystems.
-
Step 2
Open your text editor for composing the Java program. Save the file with the name myFirstJavaProgram.java.
-
Step 3
Type the following code into the text editor and save the file.
class myFirstJavaProgram
{
public static void main (String[] args)
{
System.out.println("This is my first Java application! Don't forget to end the line with a semi-colon!);
} // end of main
}// end of class -
Step 4
Compile the Java class into byte code. To do this, open the command prompt on a Windows computer or the command line in Unix. Change the directory to that which the Java file is saved, and type javac myFirstJavaProgram.java. This command will convert the Java source code to byte code.
-
Step 5
Invoke the Java interpreter on the command line by typing java myFirstJavaProgram. This command will invoke the Java Virtual Machine and run the program. The command line will display the program output, "This is my first Java application! Don't forget to end the line with a semi-colon!".

















