Setting Path and Classpath
How to Set Path and Classpath in Java
Setting path and classpath in Java is very simple but before
do this process you need to know about path variable and classpath variable.
Here I will show you how to set path and
classpath in Java in very simple and easy way.
Path Variable
Path variable is set for providing path for all Java tools
like java, javac, javap, javah, jar, appletviewer which are used in java
programming. All these tools are available in bin folders so we set path upto
bin folders.
Classpath Variable
Classpath variable is set for providing a
path for predefined Java classes which is used in our application. All classes
are available in lib/rt.jar so
we set classpath upto lib/rt.jar.
set the path and classpat.
Go on my computer icon and right click,
after that click on properties
Now click on advance setting
Click on advance
Click on Advance
variables
Click on new
button which is below the first box.
Now one dialog box
is appear, now ignore this but do not close
Now open my
computer open c:/ > Programs Files > java > java1.6.0 > bin copy
this path
Now come back on
previous open dialogbox and write variable name 'path' and for
variable value paste all copied path upto the bin folder. Put .; at the end.
Now open my
computer open c:/ > Programs Files > java > java1.6.0 > jre >
lib > rt.jar copy this path
Now again come
back on Environment variable dilogbox and click on new. Now one box is open and
write path variable as 'classpath' and for variable value paste all copied paths upto rt.jar. Put .;
at the end. It (.)
Popular
Java Editors
To write your Java programs, you will need a text editor.
There are even more sophisticated IDEs available in the market.
But for now, you can consider one of the following −
Notepad− On Windows machine, you can use any
simple text editor like Notepad (Recommended for this tutorial),Text Pad.
Netbeans− A Java IDE that is open-source and free which can be downloaded
from https://www.netbeans.org/index.html
Eclipse−A Java IDE developed by the eclipse
open-source community and can be downloaded from https://www.eclipse.org/