Welcome to my blog, hope you enjoy reading
RSS

Friday 5 April 2013

Difference between path and classpath in Java environment


Difference between path and classpath in Java environment

Both are the Environment variables, which is mainly used to set with some values which is in some location and used in some other locations.
PATH: is a system variable used to tel to OS all locations of exec files.
example:- Like your java, javac, jar etc are located in C:\java\bin (if java installed in C:\java location). Here these commands can be used by only that location, in case if you the program in different location, then this location does not know where these commands there, CMD promt simply says Command not recognized.
This we set three ways - Command based ( this will available only for tht command)
- Window based ( this will available only for tht window)
- Through Environment variable ( this will available only for all widows)
CLASSPATH : Is Pure java variable, which is used to tel locations of all jar/zip(classes) files to Compiler.
example:- If we are using JDBC Driver then we need to keep classes12.jar in classpath
:- If we are using sevlets future then we need to keep servlet-api.jar in classpath .. like these so many places we use this.
This we set three ways - Command based ( this will available only for tht command)
- Window based ( this will available only for tht window)
- Through Environment variable ( this will available only for all widows)

0 comments: