ChartDirector 7.0 (Java Edition)

DrawArea.setSearchPath2


Usage

public void setSearchPath2(ClassLoader loader[, String path])

Description

Sets the ClassLoader for loading images.

Please refer to Path Specification on how ChartDirector interprets pathnames.

By default, ChartDirector will use a ClassLoader (java.lang.ClassLoader) to search for image files. A ClassLoader will search its class path, using the same method for locating a Java class. A ClassLoader can load the images even if they are inside a JAR file.

In some systems, there are multiple ClassLoaders with different class paths. An example is a JSP web server with multiple servlet contexts. The setSearchPath2 method allows you to specify the ClassLoader to use for loading the images. If you do not specify the ClassLoader to use, ChartDirector will use the ClassLoader that loads ChartDirector itself.

Note that a ClassLoader loads images as Java resources. The image path will be handled as a Java resource path, that is, the path needs to be delimited by "/", and there must be no leading "/".

The setSearchPath2 accepts an optional argument for specifying a search path for searching the image under the class path. Multiple directories are supported by separating them with semicolons.

To disable searching using the ClassLoader, set the ClassLoader to null.

Arguments

ArgumentDefaultDescription
loader(Mandatory)The ClassLoader used to load the resource.
pathnullThe path to prepend to the image path. Multiple paths are supported by separating them with semicolons.

Return Value

None