In this tutorial, you will learn how to compile and run a very simple Java program using "rocks and sticks" technology.
This is a summary of what will be covered:
(1) Create source file.
(2) Compile source file into class file.
(3) Run class file.
(4) Troubleshooting.
(1) Create:
Create a directory in which to work in. For example: C:\workspace
Create a new file named Example.java (case matters) in the directory.
Populate Example.java with the following content using a text editor:
public class Example {
public static final void main(String[] args) {
System.out.println("Not too exciting yet.");
}
}
Be sure to save the changes to Example.java
(2) Compile:
Open a DOS prompt and cd into C:\workspace or whatever you used.
Use the javac command to compile Example.java as seen below:

(3) Run:
Reusing the same DOS prompt, or restoring if needed, run the Example.class in the JVM like so:

(4) Troubleshooting:
Compilation errors:
Rule out typos by using Example.java as your source file.
Verify that Example.java is in the directory where javac is being executed.
If the javac command is not being found- review Java: Getting Started for more ideas.
Runtime errors:
Verify that Example.class exists in the directory where java is being executed. Either change to the appropriate directory, or ensure that Example.java was indeed compiled.
If the java command is not being found- review Java: Getting Started for more ideas.
Next Steps:
Eclipse: Getting Started - coming soon!