Running Java on Windows

This is a brief step-by-step guide for creating and running the first Java program on most Windows machines. The instructions take the simplest approach, which uses the MS-DOS command-line window. Some basic knowledge of MS-DOS is also presented.

Steps for installing Java

  1. Visit the site for downloading Java 2 SDK, Standard Edition, Version 1.3.0
  2. Click on "continue" to download Java 2 SDK, v 1.3.0 Software for Windows 95 / 98 / 2000 / NT 4.0 (Intel Platform). (Note that a previously posted link may have led you to download version 1.3.0_01, which will also work).
  3. Read and accept the license agreement.
  4. Download the software choosing one of the FTP options or the HTTP option.
  5. This will put an exe file (e.g. j2sdk1_3_0-win.exe) on your computer. Double-clicking on this file will install the java software.
  6. This should create a new folder on your computer called JDK1.3 (or JDK1.3.0_01 if you downloaded the alternate version).

Steps for running the files for the first assignment

  1. Download the three java files Draw.java, DrawFrame.java and Keyboard.java. Make sure they are all in the same directory and make sure that you keep the same names. It won't work if you change the file names (unless you also change the class names in the file). These instructions will assume that you place these files in a folder called CSC314 located at the top level of your C drive.
  2. Start the MS-DOS command window.
  3. Set the path to tell MS-DOS where the java commands are. Assuming that your setup program created the folder jdk1.3, type in this command: PATH c:\jdk1.3\bin If your files are in the folder jdk1.3.0_01, type PATH c:\jdk1.3.0_01\bin
  4. Change the directory to where your program files (e.g. Draw.java) are. For example, if your files are in the folder CSC314 on the C drive (and not inside of another folder), you would type this command: CD c:\csc314
  5. Try compiling the program: javac Draw.java
  6. Try running the program: java Draw

Additional instructions

Other than CD and the java commands, it really isn't necessary to know any more DOS commands. You can manipulate the files using the Windows interface.

The simplest way to edit a file is to use the Notepad editor. After you make a change, save the file. Then, recompile and run the program again.


Craig S Miller
Last modified: Sun Jan 14 20:16:02 CST 2001