How to set path for Java
The path is required to be set for executing the java program.
There are two ways to set the path in Java:- Temporary
- Permanent
1) Set the Temporary Path of JDK in Windows
To set the temporary path of JDK, we needs to follow the following steps:
- Open the command prompt
- Copy the path of the JDK/bin directory
- Write in command prompt: set path=copied_path
This path is valid for a particular session. To avoid this better set path in environment variable as permanent path.
2) Set Permanent Path of JDK in Windows
To set the permanent path of JDK, we needs to follow the following steps:
- Go to MyComputer properties
- Click on the advanced tab
- Click on environment variables
- Click on the new tab of user variables
- Write the path in the variable name
- Copy the path of bin folder
- Paste path of bin folder in the variable value
- Click on ok button
Setting Java Path in Linux OS
Setting 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/
No comments:
Post a Comment