Compiling and Running Java

To compile and run the following programs, you would have to download and install the Java compiler from Sun Microsystems and have it properly configured for your computer.

After the installation, you may run the Java compiler in a DOS window with the command javac followed by the complete name of your file, taking care as to the case, as the Java compiler is case sensitive. For example:

javac hello.java

If the compilation proceeds correctly without errors, the file hello.class should have been created. To execute the compiled code in the DOS window, you would type in the command:

java hello

However, if you are using TextPad to edit your Java program, you could configure TextPad to compile and run Java from within TextPad using the following steps: