public class LoaderConfiguration extends Object
The stream can be for example a FileInputStream from a file with the following format:
# comment main is classname load path load file load pathWith${property} load pathWith!{required.property} load path/*.jar load path/**/*.jar
load ./*.jar
or load *.jar
are not supported.Defining the main class is required unless setRequireMain(boolean) is called with false, before reading the configuration. You can use the wildcard "*" to filter the path, but only for files, not directories. To match directories use "**". The ${propertyname} is replaced by the value of the system's property name. You can use user.home here for example. If the property does not exist, an empty string will be used. If the path or file after the load command does not exist, the path will be ignored.
RootLoader
Constructor and Description |
---|
LoaderConfiguration()
creates a new loader configuration
|
Modifier and Type | Method and Description |
---|---|
void |
addClassPath(String path)
Adds a classpath to this configuration.
|
void |
addFile(File file)
Adds a file to the classpath if it exists.
|
void |
addFile(String filename)
Adds a file to the classpath if it exists.
|
void |
configure(InputStream is)
configures this loader with a stream
|
URL[] |
getClassPathUrls()
The classpath as URL[] from this configuration.
|
List<String> |
getGrabUrls()
The extra grab configuration.
|
String |
getMainClass()
Returns the name of the main class for this configuration.
|
void |
setMainClass(String classname)
Sets the main class.
|
void |
setRequireMain(boolean requireMain)
Determines if a main class is required when calling.
|
public LoaderConfiguration()
public void configure(InputStream is) throws IOException
is
- stream used to read the configurationIOException
- if reading or parsing the contents of the stream failspublic void addFile(File file)
file
- the file to addpublic void addFile(String filename)
filename
- the name of the file to addpublic void addClassPath(String path)
path
- the path as a path separator delimited stringFile.pathSeparator
public URL[] getClassPathUrls()
URLClassLoader
public List<String> getGrabUrls()
public String getMainClass()
public void setMainClass(String classname)
configure(InputStream)
after calling this method does not require a main class
definition inside the stream.classname
- the name to become the main classpublic void setRequireMain(boolean requireMain)
requireMain
- set to false if no main class is requiredconfigure(InputStream)