I'm reading my textbook and it said if I'm downloading java jdk Id want to set my path variable. But I already download my java JDK and JRE and its completely functioning.(I'm using eclipse). However, I'm curious about the path variable and what it does specifically.
2 Answers
In short, it provides a list of directories where executable files can be found without specifying the full-path to the binary.
If you open a command-line-interface on your machine, you can type many commands without having to specify the path to the program. i.e. fdisk, shutdown, ipconfig, nslookup, etc... Keep in mind, that there are also some built-in commands that are built into the command-line-interpreter that are not a separate program... like dir, echo, cls, etc...
The purpose the JRE/JDK wants to modify your PATH environment variable is simply to be able to type java at the command-line without having to specify the full path (i.e. "c:\Program Files (x86)\Java\jre1.8.0_211\bin\java.exe")
You can modify/view your own PATH environment variable by clicking on the search-bar in windows, and type in "edit the system environment variables".
There are actually 2 sets of environment variables, and they will get merged when you open the command prompt. The ones listed under "System variables" affect the whole system, and all users that log into that computer. The ones listed under "User variables for blahblah" only affect the currently logged in user.
- 10,912
Basically, the PATH it defines a set of directories on which programs will be searched for when only the program name is provided, instead of an absolute/relative path.
This is how the OS can find the right program to run when you only type "java" in the terminal, for instance.
Otherwise you would have to provide the full path, like "%JAVA_HOME%/bin/java".
- 173
