1 Classpath Tells applications where to find third-party and user-defined classes The search order used by java tools Java platform (bootstrap) classes, any extension classes, and the class path Two ways to change class path -classpath option change the class path of java tools CLASSPATH environment variable The first approach is preferred
3 Classpath and Archive files Classes can be stored either in directories (folders) or in archive files ( jar files) eg. The Java platform classes are stored in rt.jar. Class path to the archive files For a .jar or .zip file that contains .class files, the path ends with the name of the .zip or .jar file eg. : javac –classpath d:\project\utilClasses.zip eg. : javac –classpath e:\xml\xalan.jar
4 Multiple Path Entries Multiple path entries are separated by semi-colons To find class files in the following directories C:\java\MyClasses C:\java\OtherClasses set the classpath to: C:> java –classpath C:\java\MyClasses;C:\java\OtherClasses Order of classpath entries is important