A Learning Journey

–By Sharing Knowledge

Archive for the ‘Chapter-III’ Category

what is path and classpath and how to set path and classpath

CHAPTER-III: About ‘Path’ and ‘Classpath’

Posted by krishnamm on February 9, 2009

Chapter-III

 

In Previous chapter, we have discussed about path and classpath…but what is this path and classpath and why we need to set these variables. what is thier role?? we have to learn that…

What is path?

An environment variable that lists the directories the command processor searches for *.exe.

If you do not set the PATH variable, you need to specify the full path to the executable every time you run it, such as:

C:\Program Files\Java\jdk1.6.0\bin\javac MyClass.java

What is classpath?

The CLASSPATH variable is one way to tell applications, including the JDK tools, where to look for user classes. (Classes that are part of the JRE, JDK platform, and extensions should be defined through other means, such as the bootstrap class path or the extensions directory.)

 The default value of the class path is “.”, meaning that only the current directory is searched. Specifying either the CLASSPATH variable or the -cp command line switch overrides this value.

To set classpath, the process is: MyComputer –>(right click): properties –>Advanced –> Environmental variables . You can create classpath variable or modify if already.

same thing for path setting as well.

You will get more info regarding path and classpath in below link.

http://www.dil.univ-mrs.fr/~garreta/docJava/tutorial/essential/environment/paths.html

 

 
Advertisements

Posted in Chapter-III | Leave a Comment »