How to set Temporary and Permanent Paths in Java
First of all we have to know that if java source file is jdk /bin directory then no need to set java path the bin folder if java file is saved outside the jdk/bin folder then we need to set path
There are tow common way to set java paths
- Temporary Path
- Permanent Path
1. steps to set temporary path
- Open my computer and double click on C drive go to program file and open java folder double click on jdk
- Copy the path of jdk/bin directory
- Write in command prompt:SET PATH=copied_path
for example :- SET PATH= "C:\Program Files\Java\jdk1.5.0\bin"
- create java source file in notepad or notepad++ and save the file as class name.java
- example
class A
{
public static void main(String args[])
{
System.out.println("Hello");
}}
save this file as A.java in C drive or any other drive
- open cmd and set the above given path
- type javac A.java for compilation after successful compilation A.class file is generated
- to run java program type java A
Setting Permanent Java Path:
- Go to My PC properties and click on properties
- Click on Advanced system settings
- place semicolon at the end of existing path and past copied path till bin
C:\Program Files\Java\jdk1.5.0\bin and press ok button
No comments:
Post a Comment