Classpath

myrajendra 789 views 4 slides Feb 20, 2013
Slide 1
Slide 1 of 4
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4

About This Presentation

No description available for this slideshow.


Slide Content

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

2 Setting the Classpath -classpath jdkTool -classpath path1;path2... eg. : javac –classpath d:\project\classes CLASSPATH environment variable eg. : SET CLASSPATH d:\project\classes

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
Tags