How to Set Path in Java
Java Path setting
The path is required to be set to access the java tools like javac, jar, java and javadoc tools.
Need of path setting
To use the java tools outside the JDK/bin folder, it's necessary to set path, if you saving your java program in JDK/bin folder then there is need to set the path of bin folder.
Way Of Setting Path
There are two ways to set path in windows.
Temporary path setting
Steps of temporary path setting in windows.
1. First copy the path of JDK/bin folder.
2. Open the command prompt (cmd), to open CMD press window + R and type cmd.
3. Type set path=C:\Program Files (x86)\Java\jdk1.8.0\bin
set path=C:\Program Files (x86)\Java\jdk1.8.0\bin
Your temporary path have been set successfully.
Let's see in the following figure.
Note: Note: when you close command prompt the path will be unset that means you cannot access the java tools.
Permanent Path Setting
Steps of permanent path setting in windows.
Step:1 Copy the location of bin folder like previous one.
Step:2 Right click on computer and go to the properties.
Step:3 click on advance system setting.
Step:4 Select advance tab
Step:5 Click on environment variable a environment variables window will appear.
Step:6 click on new button
Step:7 Tppe name= path and value=paste the bin folder location.
Step:8 Say ok
Step:9 Say ok
Your Permanent path have been set successfully.
Why does give the path of bin folder?
We give the path of bin folder at the time of setting path because of all the java tools like javac, java, javadoc and many other are there. To access these java tool from anywhere of your computer, set the path of bin folder.
Difference between user variable and system variable?
User variables means that the path is set for specific user in this case umar khan is the user while in case of system variables path will be set for all user.