Java Reference
In-Depth Information
The only commands you need to look for are any that begin with
PATH
.
The
PATH
command is followed by a space and a series of folder names separated by
semicolons. It sets up the
PATH
variable, a list of folders that contain command-line pro-
grams you use.
PATH
is used to help MS-DOS find programs when you run them at a command line. In
the preceding example, the
PATH
command in Figure A.6 includes two folders:
n
C:\PROGRA~1\MSBOB
n
C:\jdk1.6.0\bin
You can see what
PATH
has been set to by typing the following command at a command
line:
PATH
To set up the kit correctly, the folder that contains the Java interpreter must be included
in the
PATH
command in
AUTOEXEC.BAT
.
The interpreter has the filename
java.exe
. If you installed JDK 1.6 in the
C:\Program
Files\Java\jdk1.6.0
folder on your system,
java.exe
is in
C:\Program
Files\Java\jdk1.6.0\bin
.
If you can't remember where you installed the kit, you can look for
java.exe
: Choose
Start, Find, Files or Folders. You might find several copies in different folders. To see
which one is correct, open a command-line window and do the following for each copy
you have found:
1.
Use the
CD
command to open a folder that contains
java.exe
.
2.
Run the command
java -version
in that folder.
When you know the correct folder, create a blank line at the bottom of the
AUTOEXEC.BAT
file and add the following:
PATH rightfoldername;%PATH%
For example, if
c:\Program Files\Java\jdk1.6.0\bin
is the correct folder, the follow-
ing line should be added at the bottom of
AUTOEXEC.BAT
:
PATH c:\”Program Files”\Java\jdk1.6.0\bin;%PATH%
The
%PATH%
text keeps you from wiping out any other
PATH
commands in
AUTOEXEC.BAT
.
In this command, quotation marks have been added around the folder name
Program
Files
. Some versions of Windows require this to handle folder names that contain
spaces.