How to install and use the JDK
Java 2 SDK is a software development kit made available for free by Sun Microsystems.
The package gives you all the tools necessary for creating Java applications and
current version of the SDK is J2SETM 1.4 (JavaTM 2
Standard Edition v 1.4) and this is the version we use on this course.
following steps explain how to install the J2SETM on your PC running
Windows 9x and NT(2000,XP).
your first program
Java 2 SDK from Sun
can download the installation file directly from Sun's website at:-
should ensure you download the SDK
(Software Development Kit) and not the JRE
(Java Runtime Environment.)
should end up with a file called j2sdk-1_4_0_01-windows-i586.exe
Uninstall any Prior Version of the Java 2 SDK
If you have previously installed another version of the Java 2 SDK, uninstall it.
Use the Microsoft Windows Add/Remove Programs utility, accessible from the Control Panel (Start --> Settings --> Control Panel).
Run the Java 2 SDK installer
Note -- you must have administrative permissions in order to install the Java 2 SDK on Microsoft Windows 2000 and
The file j2sdk-1_4_0_01-windows-i586.exe
is the Java 2 SDK installer. Double-click on
the file to start the installation.
the installation starts, you will be presented with the InstallShield
screen. Click on "Next" and then "Yes" to accept the
license agreement. You will be prompted for the installation
directory. Choose the default directory C:\j2sdk1.4.0_01
and click "Next".
-- you can choose a different installation directory provided there are no
spaces in the path name.
clicking on "Next" you will be prompted for the components to
install. All you really need are the
"Program Files", but if you have the space available, you should
install all the components.
clicking the "Next" button again you will be asked if you wish to
set the Java Plug-in as default for any browsers you have installed.
Tick all the boxes and click on "Next".
installation files will now be copied. When the installation is
complete, a "Setup Complete" window is displayed, and you have the
option to read the README file. Click on the
"Finish" button when you are ready.
Delete the downloaded file (Optional)
If you want to recover disk space, delete the file you originally downloaded.
PATH variable is used to tell the computer the
location of the java executables (javac.exe, java.exe, javadoc.exe, etc.)
You can run the Java 2 SDK without setting the PATH variable, or you can optionally set it as a convenience.
If you don't set the PATH variable, you need to specify the full path to
an executable every time you run it, such as:
C:> \j2sdk1.4.0_01\bin\javac MyClass.java
If you want to be able to conveniently run the Java 2 SDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the
command you should set the PATH variable.
Once the PATH is set, running an executable is
simpler. For example, the command above becomes:
your path depends on what version of Windows you are using. Set the
PATH as follows, according to whether you are on Microsoft Windows NT or 95/98/2000/ME.
the Path - Microsoft Windows 98 and 95
you are running Windows 95/98, open the
file with a text editor like NotePad. All you need to do is add ;C:\j2sdk1.4.0_01\bin;
to the end of the line which contains the
is an example
To make the path take effect in the current Command Prompt window, execute the following:
To find out the current value of your PATH, to see if it took effect, at the command prompt, type:
new path should include the "c:\j2sdk1.4.0_01\bin"
directory. As a final test to make
sure everything has been installed correctly, type "javac"
at the command prompt. If
you get the output:
command or file name
your path has not been modified correctly. If you get the output:
javac <options> <sourcefiles>
by a list of possible options then everything is correctly installed,
and you are ready to start developing Java programs on your PC!
Setting the Path - Microsoft Windows NT, 2000, and XP
Choose Start, Settings, Control Panel, and double-click System. On Microsoft Windows NT, select the Environment tab; on Microsoft Windows 2000
and XP select the Advanced tab and then Environment Variables. Look for PATH
in the User Variables and System Variables. Add the j2sdk
PATH to the right end.
Typically you would add:
Click "Set", "OK" or "Apply".
your first program
Steps - Using Java
Your computer system should now be ready to use the Java 2 SDK.
To get the feel of some simple java
applets, try running the following applets.
the command prompt and change to the Java C:\j2sdk1.4.0_01\demo\applets
directory by typing
Now type the following and see what you get.
are some more you can try
-- you can also view any of the applet examples in the demo applet directory
by double-clicking a HTML file. For example, double-clicking the example1.html
file in the animator directory would load the applet into your default browser
try writing your first Java applications and applets >>