Installing and running Java on Windows
These instructions, posted 1 December 2005, are for version 5.0 Update 5. They can be used to download any new version by changing to the appropriate version numbers in all steps.
Downloading Java SDK for Windows 2000/XP
-
Open a web browser and go to http://java.sun.com
- On the right-hand column, click on 'J2SE 5.0'
- Click on the link 'Download JDK 5.0 Update 5'
- Before you can proceed with the download, you must accept the license agreement.
- Select the file 'jdk-1_5_0_05-windows-i586-p.exe' (57.49MB) and download it.
- Once the file is downloaded, open the file and install it by following the instructions.
During installation, set the installation directory to: C:\Program
Files\Java\j2sdk1.5.0_05
Setting the environment path variables in Windows 2000/XP
- Right click on 'My Computer' and select 'Properties'.
- Click on the 'Advanced' tab and press the 'Environment Variables' button.
- Under System variables, double click on the variable name 'Path' (or 'PATH').
A box will appear to allow editing of the Path values.
- In the Variable Value field, add: C:\Program Files\Java\j2sdk1.5.0_05\bin
This must be separated by a semicolon from any other entry in that box.
The Java binaries should be installed at this location. If not, change the path so that it points to the correct location.
- Click 'OK' on all the windows to exit out of the dialog.
- Restart the computer.
Compiling and Executing
- Open up a MS-DOS terminal (Start > Run > 'cmd' [without the quotes]).
- Go to the directory where the .java source files are located (using 'cd' command).
- To compile the .java file, enter: javac filename.java
This will compile the .java file into a .class file.
- To execute the Java program you just compiled, enter: java filename