How to set path in JavaThe path is required to be set for using tools such as javac, java, etc. If you are saving the Java source file inside the JDK/bin directory, the path is not required to be set because all the tools will be available in the current directory. However, if you have your Java file outside the JDK/bin folder, it is necessary to set the path of JDK. There are two ways to set the path in Java:
1) How to set the Temporary Path of JDK in WindowsTo set the temporary path of JDK, you need to follow the following steps:
For Example:set path=C:\Program Files\Java\jdk1.6.0_23\bin Let's see it in the figure given below: 2) How to set Permanent Path of JDK in WindowsFor setting the permanent path of JDK, you need to follow these steps:
For Example:
Now your permanent path is set. You can now execute any program of java from any drive. Setting Java Path in Linux OSSetting path in Linux OS is the same as setting the path in the Windows OS. But, here we use the export tool rather than set. Let's see how to set path in Linux OS: export PATH=$PATH:/home/jdk1.6.01/bin/ Here, we have installed the JDK in the home directory under Root (/home). You may also like: How to set classpath in JavaNext TopicDifference Between JDK JRE And JVM |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India