To run a Java program you need to save the .java file in the bin directory otherwise you can't run the program without setting up the path to the bin. This is necessary because the Java Compiler, Java Application Launcher, etc. reside in the bin folder.
Several steps are there involving in setting path permanently for Java
Step 1: Click on Start Menu ->> Right Click on My Computer ->> Select Properties
![set path](https://test.c-sharpcorner.com/UploadFile/941fc8/set-path-for-java-in-windows-xp/Images/set%20path1.gif)
Now, you'll see the System Properties window as shown in following image.
Step 2: Select Advanced tab.
![set path in java](https://test.c-sharpcorner.com/UploadFile/941fc8/set-path-for-java-in-windows-xp/Images/set%20path2.gif)
Step 3: Click on Environment Variables button.
![java path](https://test.c-sharpcorner.com/UploadFile/941fc8/set-path-for-java-in-windows-xp/Images/set%20path3.gif)
Now, another window is popped up as shown in the following image:
![set java path in xp](https://test.c-sharpcorner.com/UploadFile/941fc8/set-path-for-java-in-windows-xp/Images/set%20path4.gif)
Step 4: Select variable Path and press Edit button.
![set java path](https://test.c-sharpcorner.com/UploadFile/941fc8/set-path-for-java-in-windows-xp/Images/set%20path5.gif)
Edit System Variable window is shown, as follows:
![java path](https://test.c-sharpcorner.com/UploadFile/941fc8/set-path-for-java-in-windows-xp/Images/set%20path6.gif)
Step 5: Add a semicolon ( ; ) and then your path to bin folder (can be find it in the Installation Directory which is specified at the time of installation of JDK) at the end of variable value.
![set path](https://test.c-sharpcorner.com/UploadFile/941fc8/set-path-for-java-in-windows-xp/Images/set%20path7.gif)
Press OK.
Hurray!!! You have set-up the path.