I want my JAVA (or whatever) directory to be automatically
searched so that I can access java from any directory.
How do I modify environment variables PATH to allow this?
(a) Here is how to do it in Windows 95:
go to the start menu->control panel. Click on the
the system icon. Choose the environment tab,
and click on the user PATH variable.
You can now modify its value in the
appropriate value box.
When done, click apply. Now when you invoke
MS-DOS or WINDOWS, the new value of the path
variable will be used. [Note: you can add new
environment variables this way too]
(b) You can also do this within the MS-DOS (but
unlike the previous approach, it will not survive a reboot).
Suppose your JAVA is found is in Z:\jdk\bin. To add this
to the path, you type the following to the DOS prompt:
:> set path = <old-path>; Z:\jdk\bin
where <old-path> is the original value of path.
One way to automate this process is to create a
``bat file'' (say, mypath.bat) which performs this function.
Note that ``path'' will print the value of the
current path variable. Hence, to put this information
into mypath.bat, do:
:> path > mypath.bat
(The reason we do this is because the path variable may contain
lots of directories that are too tedious to retype.)
Now use an editor to edit mypath.bat, i.e., you insert
``set '' to the beginning of the line, and ``; Z:\jdk\bin''
to the end of the line. Now you can execute this bat file
each time you need it.