Home           J2EE Concepts           JMS           Java Language           Contact           Back           Next           Bookmark this Page          










Some useful tips related to:
 - health & fitness
 - vehicle care
 - cooking
 - misc household tasks

Classpath


In simple words, Classpath works the same way for JVM as Path works for Windows.

When JVM is asked to execute any class, it looks for the locations specified in CLASSPATH system variable. The CLASSPATH variable must point to the class location and have one of following values:
- The folder containing the class file if the class is packaged under default package.
e.g.: C:\test (the class file is kept in test folder)
- The folder containing the folder hierarchy of class file if the class is not packaged under default package.
e.g.: C:\test\pkghierarchy (the package folder of class file is kept in pkghierarchy folder).
- In case, the class is available in some jar file, then path of the jar file (including the jar file name) must be present.
e.g.: C:\test\myClass.jar (the class file is kept in myClass.jar file).