You must compile your class first....
To compile:
javac ExampleProgram.java
In the above example you will end up with 2 files
1. ExampleProgram.java
2. ExampleProgram.class
To run your program:
java ExampleProgram
Note: when you execute your program you dont use the ".class" extension.
Also you example class needs to be public.
// dont forget the public modifier here...
public class ExampleProgram {
public static void main(String[] args){
System.out.println("I'm a Simple Program");
}
}
Main Topics
Browse All Topics





by: bobbit31Posted on 2003-09-02 at 14:51:40ID: 9270456
the name of the file should be ExampleProgram.java