To run Java Programe it is very necessary to set path in Environment Varibles. You can run java file using temporary setting the path in Cammand Promt.
You can run java programe without setting any path if you saved your file in C:\Program Files\Java\jdk\bin folder.
If you have a java file outside bin folder. Please set the path temporary in Command Prompt or parmanently in Environment Variables.
There are two way to set java path:
How to set Temporary Path of JDK in Wondows
To set the temporary path of JDK, you need to follow following steps:
• Open Your Command Prompt
• Write in Command Prompt: set path=C:\Program Files\Java\jdk\bin
Let's see it in the figure given below:
How to set path of JDK Permanently in Windows.
For setting the permanent path of JDK in Windows, you need to follow these steps:
Click on Start Button> Right Click on Computer > Click on Properties
Click on Advanced system setting
Click on Environment Variables
Click on New
Here is the Variable path windows will be open.
Copy the path of bin folder where JDK installed.
Write path in Varible Name Input Box and write C:\Program Files\Java\jdk1.8.0_73\bin in Variable Value Input Box.
Use the same process for CLASSPATH
• Variable Name: classpath
• Variable Value: C:\Program Files\Java\jdk1.8.0_73\lib
Use the same process for JAVA HOME
• Variable Name: JAVA_HOME
• Variable Value: C:\Program Files\Java\jdk1.8.0_73
Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section. We will be very happy to hear that.