Path vs ClassPath

5 May 2008

I have found may people asking the difference between ClassPath and path. They tend to mix these and find this confusing. I will address this issue in this post.

Path is simply a system wide variable that tells where to find your commands. Like you can run directory command (dir) from an path. This is so because Windows path is set in the path variable. To see the contents of path variable, use following command on command prompt:

echo %PATH%

Now lets talk about Classpath. It is Enviroment Variable that tells JVM or Java Tools where to find your classes. You may include different useful packages in the classpath for easy referencing. To view the contents of the classpath, use following command on command prompt:

echo %CLASSPATH%

Example:
Assume that Java is installed in C:\jdk1.5.0\ and your code is in C:\Test\example.java, then your PATH and CLASSPATH should be set to:

PATH=C:\jdk1.5.0\bin;%PATH%
CLASSPATH=C:\Test

I hope this helps.

del.icio.us:Path vs ClassPath  digg:Path vs ClassPath  spurl:Path vs ClassPath  wists:Path vs ClassPath  simpy:Path vs ClassPath  newsvine:Path vs ClassPath  blinklist:Path vs ClassPath  furl:Path vs ClassPath  reddit:Path vs ClassPath  fark:Path vs ClassPath  blogmarks:Path vs ClassPath  Y!:Path vs ClassPath  smarking:Path vs ClassPath  magnolia:Path vs ClassPath  segnalo:Path vs ClassPath  gifttagging:Path vs ClassPath

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: Path vs ClassPath

Leave a Reply