Why use the PATH variable?
Once a programs location (folder) is added to the PATH variable, it becomes accessible from any other location. Normally you need to open an application by typing an absolute or relative path. With a global path variable, referring to the containing folder is not needed anymore.
Also take a look at wikipedia.
The JDK executables that you need for running, compiling and other things, are located in the installation directory. Often this is something like C:\Program Files\Java\jdk1.6.0_21\bin.
Add the path of the JDK to the PATH variable
- Right click “My Computer” icon
- Choose “Advanced system settings” from the left menu
- Click “Environment Variables..." at the bottom
- In the "System variables" list, select the "Path" line and "Edit..." this line.
- Type the path to your JDK's "bin" directory (C:\Program Files\Java\jdk1.6.0_21\bin) in front of the other entries and separate it by a ";".
- Click OK several times to exit the windows.
PATH errors
Errors that are shown when you did not add the directory correctly:
- 'javac' is not recognized as an internal or external command, operable program or batch file.
- 'java' is not recognized as an internal or external command, operable program or batch file.
What is in your PATH variable by default?
In my Windows 7 OS I see the following by default:
- %SystemRoot%\system32;
- %SystemRoot%;
- %SystemRoot%\System32\Wbem;
- %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
- C:\Program Files\Java\jdk1.6.0_21\bin;
- %SystemRoot%\system32;
- %SystemRoot%;
- %SystemRoot%\System32\Wbem;
- %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\


Geen opmerkingen:
Een reactie posten