Hi Friends
What is Difference between class and classPath?
Difference between class and classPath
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Oct 16, 2012, 5:27 AM EDT
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)
Please refer the below link
http://www.javabeat.net/qna/371-difference-between-path-and-classpath/
Thanks
If this post helps you mark it as answer