Java from the DOS Prompt

  1. Create a folder with the source code (.java) files, one file for each class. To start, just create a simple Main class with a main method with NotePad.

  2. Open a DOS Window (called a Command Window in Windows 2000).

  3. Check the path by entering "path". See if C:\JDK1.3\BIN is in the path.

  4. If jdk1.3 is not in the path, add it to the path:
    set PATH=c:\jdk1.3\bin;%PATH%
    Note: the drive and path to JDK1.3 might be different on your computer or in the computer labs. However, the path in the computer labs should already be okay.

  5. Compile all .java files. For example:   javac Main.java

  6. Clear the CLASSPATH as follows:   set CLASSPATH=

  7. Execute the main method in the class Main. For example:   java Main