How to set a path enviroment variables in windows operating system
They are two types of path environment variable settings mainly.
1.Setting a path for only one command prompt,
2.updating environment variables to every command prompt.
one more
3.set the path for to separate the ".class" and
".java" files in a separate folder based on type of file.
Type 1.setting a path environment variable for only one command prompt :
to set the path of environment variables for only that command prompt
through by using command prompt only...
1.go to command prompt and type as
2.TO set the path on cmd :>set path =D:\JDK7.0\bin
3.type as >echo %path%
4.enter then it display the specified path .
5.run the java by using javac or java on command prompt.
6.if it run ed successfully the path is settled to that command prompt.
Type 2.updating the path of environment variables to every command prompt :
1.Go to my computer
2.select the properties
3.go to the advance system settings.
4.a window will opened
5.select the environment variables.
6.use the user variables only...to set a path ,because these are
very secure and comfortable to use...
7. Click on new button of user variables.
8.A window will opened with two fields.
- Variable name
- Variable value.
variable name is "path"
variable value is :your jdk bin file located location only.
my jdk bin location is "D:\JDK7.0\bin"
after set that path and click on ok button to save it.
9.Go to command prompt
10.its no need to set the path again comma prompt
11.type as echo %path% on command prompt you can see the path location
12.run java by using javac or java
13.if it run successfully your path is updated to every command prompt.
Type 3: set the path of environment variable for separating the ".java" files and ".class" files separately in a separate folder.
1.to set the path for separate folder to save .java and .class files
as follows...
2.go to any eclipse or edit plus or notepad i am choosing note pad...
3.Type a java program on it and save it as on the some separate folder
not it on as "jdk bin folder "OK..
4.save the file as no space and as same as class name with extension
of ".java"
5.file name while to save ,keep it as in double cotes mark ""only.
6.Save it..
7.My file is saved on e:javaprograms\section2\app1\src..
8.come to command prompt.
9.move to filed located drive or folder by using "cd"-change directory.
10.then compile the program as follows
11.type as to compile normally :>javac Hello.java"
12.but we are separating the ".java"file and ".class"file so we need to
do as on command type :>javac -d ../classes Hello.java"
13.Then it compiled and .class file is saved on classes folder not in
src ie.. ".java"file saved located .it is separated..
14. here "-d"is used to specify the location where to save the ".class" file .
"-d ../folder name"- here folder name is where you want to save the
".class" file location...
15.if any errors occur correct it..and recompile it..
16.if it compiled successfully ,then move to run that program
17.to running a java program we need ".class" file
18.so move to '.class "file located location..
19. it successfully run ed and output is display..
20.let us see the files of ".class"and ".java" file locations..
21.here the ".class"file is located on another folder not in ".java" file located place...