Site hosted by Angelfire.com: Build your free website today!
 

Compile and Run

Save the program as HelloWorld.java. Compile the program:

Look at the directory (ls), you should see a file called HelloWorld.class. This file is generated by the javac compiler. It contain the bytecode of your source program.

To execute the program, you need to use the JVM:

  • The name of the source file must matches the name of the Class, and it is case sensitive -- HelloWorld.java.

  • When you run the program, you pass the class name to the JVM (java), i.e. HelloWorld, without the .class extension.