Package org.apache.ofbiz.base.start
Class Classpath
- java.lang.Object
-
- org.apache.ofbiz.base.start.Classpath
-
public final class Classpath extends java.lang.Object
A class path accumulator.You can build a class path by repeatedly calling the addXxx methods, then use the getXxx methods to get the accumulated class path.
-
-
Constructor Summary
Constructors Constructor Description Classpath()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addComponent(java.io.File component)
Adds a class path component.boolean
addComponent(java.lang.String component)
Adds a class path component.void
addFilesFromPath(java.io.File path)
Scans a directory and adds all files ending with ".jar" or ".zip" to the class path.java.net.URL[]
getUrls()
Returns a list of class path component URLs.java.lang.String
toString()
-
-
-
Method Detail
-
addComponent
public boolean addComponent(java.io.File component) throws java.io.IOException
Adds a class path component. The component may be a directory or a file. Ifcomponent
does not exist, the method does nothing.- Parameters:
component
- The class path component to add- Returns:
true
if the component was added- Throws:
java.io.IOException
- if there was a problem parsing the componentjava.lang.IllegalArgumentException
- ifcomponent
is null
-
addComponent
public boolean addComponent(java.lang.String component) throws java.io.IOException
Adds a class path component. The component may be a directory or a file. Ifcomponent
does not exist, the method does nothing.- Parameters:
component
- The class path component to add- Returns:
true
if the component was added- Throws:
java.io.IOException
- if there was a problem parsing the componentjava.lang.IllegalArgumentException
- ifcomponent
is null or empty
-
addFilesFromPath
public void addFilesFromPath(java.io.File path) throws java.io.IOException
Scans a directory and adds all files ending with ".jar" or ".zip" to the class path. Ifpath
is not a directory, the method does nothing.- Parameters:
path
- the directory to scan- Throws:
java.io.IOException
- if there was a problem processing the directoryjava.lang.IllegalArgumentException
- ifpath
is null
-
getUrls
public java.net.URL[] getUrls() throws java.net.MalformedURLException
Returns a list of class path component URLs.- Returns:
- A list of class path component URLs
- Throws:
java.net.MalformedURLException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-