To setup the Java SE development kit (also known as the JDK) you can follow these steps on Windows: Sun's install directions for JDK.
After you agree to the lisense agreement you come to the final download page. Download the file for Windows, the link "Windows Offline Installation, Multi-language". This file is approximately 50 MB. (If a newer edition becomes available, the name and size may be different.)
After downloading, execute this setup program to install the JDK.
This will create a
directory by default.
If you rename this directory from this default,
you will have extra work to install the documentation!
Nonetheless, it will simplify advanced Java setups later if you
install to a directory with a short, simple name.
Personally I use
C:\Java as the install directory.
Running the installer is fairly easy.
Accept the license terms.
Next select what to install.
I suggest installing everything except the source code.
(This takes over 300 MB of disk space once installed.)
For each item, select where to install it; I suggest
putting the JDK in
Note that as part of the JDK, a version of the JRE is installed.
This JRE is used only when compiling code with the JDK tools, such
Next the JRE (used to run programs and applets)
installer will run.
I suggest installing everything, and letting it control all
browsers for applets.
The default location for to install the JRE is
C:\Program Files\Java\jdkversion\, and
that is fine.
However you will need to note this location down for later.
Onces installed the JRE takes about 110 MB of space.
So make sure you have about 370 MB disk space free before installing.
After the install you can delete the 53 MB installer program.
Note: The JRE is controled by the Java control panel. After the install is completed, you might want to run this control panel and change some of the default settings.
.zipfile. You need to use Winzip (or the Window built-in version) to extract the documentation.
You can install the documentation by
extracting all files at
C:\Java (or where ever
you installed the JDK at).
This should create a new directory named
When you are done, you should set a bookmark (or favorite)
to point to the documentation (the file
from your browser of choice.
I would also create a second bookmark to jump right to the API.
javawork" or some such name. Also, to run the JDK programs requires typing in long names for the executables, such as "
C:\Java\bin\javac SomeProgram.java". To be able to use short command names ("
javac SomeProgram.java") you must update the system setting known as the
PATHenvironment variable. Exactly how this is done depends on your version of Windows. If you wish you can follow the Sun's install directions for the JDK to set the
PATHenvironment variable (step 4) so you can use short command names. For the recommended setup, for the current version at the time of this writting, you should add the following to the front of the
C:\JavaWork") would be most convienent. For older Windows systems the shourt-cut can also set
CLASSPATH, which non-Sun java tools may use in an incompatible way). The directions below explain how to do this for Windows95/98/ME, and can be adapted to modern Windows.
JAVA_HOME, which may be used in more advanded setups), as well as setting a default working directory and setting (or unsetting)
CLASSPATHif necessary. Figuring out how to do this normally requires some understanding of Windows and DOS, but here are some instructions you can follow for Windows 98/ME:
AUTOEXEC.BATis a bad idea, as it may mess up Netscape, JBuilder, and possibly other Java related programs. (The JDK installation instructions say you don't need to set
CLASSPATHat all, but this is only partially true. If you develop you own packages, or install extra packages of Java classes, you may need to set
.BATfile to setup the environment for you. (Not needed for Windows 2000 or newer!) The
.BATfile should also install
DOSKEY, which allows you to repeat previous commands by use of the up-arrow key. (On some computers
DOSKEYis already installed in the
AUTOEXEC.BATfile, which is a good idea. If so, don't try to also install it in this
.BATfile.) The file I created here for HCC is called
SetUpJav.bat. The contents of the file should be:
@ECHO OFF SET JAVA_HOME=C:\Java SET CLASSPATH=. SET PATH=%JAVA_HOME%\BIN;%PATH% DOSKEY
(This is a little different than the version at HCC. )
To create this file, copy the above lines to Notepad and then save
the file with the correct name.
(Make sure Notepad doesn't add a "
extension to your file.
If so you will need to rename the file by right-clicking on it
and choosing rename.)
SetupJav.bat file can be put anywhere
I recommend putting it in
(You should use the actual install directory if different from
.BATfile to run and what the current working directory should be. The
.BATfile should be the full pathname of the
SetUpJav.batfile created in the previous step. (If you followed my recommendation, that pathname is
C:\Java\SetUpJav.bat.) At HCC, the shortcut is called
The Working directory should be set to the place where you
At HCC, I have set this directory to
but at home you may wish to use a different directory.
I personally use the directory
(Note the directory you name must be created first if it doesn't already exist!)
The easist way to create the shortcut is to copy the shortcut
MS-DOS Prompt (or "
on more modern versions of Windows) and rename the copy.
To locate this shortcut, right-click on the Start button and choose
Now double-click on "Programs" and you should see the shortcut.
Click on it once to highlight it, then choose "Copy" from the "Edit"
menu, then choose "Paste".
Now rename the copy to something like "Java".
When you have finished creating the shortcut, you need to set its properties. Right-click on the new shortcut and choose "Properties" from the menu that appears. Click on the "Program" tab to set the properties:
C:\Tempor some other directory created for this purpose.
.BATfile created earlier, under the heading "Batch file:".
Editeditor. Just click the "Screen" tab, then select "50" from the drop-down list.
The shortcut created in the previous step can be copied and placed onto the desktop if you prefer not to use the Start menu.
javacommands, it means the
PATHvariable isn't set correctly. You can still run JDK commands by typing in a full pathname, such as "
C:\Java\bin\java" if you installed in the recommended location.
If this works, your
PATH is definitely
To find out what is wrong with your
This should show you the current value of
and other environment variables.
Look at the entry for
Are any JDK directories showing?
If so, you probably have a typo so check it carefully.
If not, you probably don't have the
file listed correctly in the shortcut, or you made a typo in the
SET PATH statement.
To find out which, close your Java window.
Then add the following line to your
echo testing one two three
Save your changes and run your short-cut again.
If the window doesn't show "testing one two three" then your
.BAT file isn't being run at all.
If you do see the "testing one two three" message the problem must be with the
SET PATH statement.
.BATfile isn't being run, make sure you have the complete pathname listed in the short-cut property "Batch File:" (and not the "Cmd Line:" property) as shown above.
SET PATHcommand, make sure it looks like this (it is not case-sensitive, but note there are no spaces around the equals sign):
JAVA_HOME for typos.
AUTOEXEC.BAT. If so you can either remove the DOSKEY command from your
.BATfile, or remove it from
AUTOEXEC.BAT, or just ignore the message. I recommend you remove it from your
You need to change a property of the short-cut. If the short-cut is on the desktop, you just right click it then choose properties. If the short-cut is under the Start menu, you need to right click on the Start button, then choose open, then double click on Programs. Now right click on the Java short-cut.
Next, click on the "Memory" tab.
Finally, change the value for "Initial Environment" from "Auto" to "512". (If this is too small also, you can try a larger value later. I had to use "2816" on my home computer.)
Now click on OK, and that's it!