pTutorial

New way to learn Programming

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.

  1. Temporary
  2. Permanent

Temporary path setting

Steps of temporary path setting in windows.

1. First copy the path of JDK/bin folder.

path setting

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

For Example

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.

path setting

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.

right click on my computer

Step:3 click on advance system setting.

path setting

Step:4 Select advance tab

advance tab

Step:5 Click on environment variable a environment variables window will appear.

Environment variable

Step:6 click on new button

Java User Variable

Step:7 Tppe name= path and value=paste the bin folder location.

java user variable name

Step:8 Say ok

how to set path in windows

Step:9 Say ok

java path

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.

System variable

QUOTES OF THE DAY

To make your children capable of honesty is beginning of education.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER