public class JarFileCreator extends Object
This class is thread-safe.
| Constructor and Description |
|---|
JarFileCreator(File outputFile)
Constructs a new jar file creator.
|
| Modifier and Type | Method and Description |
|---|---|
JarFileCreator |
addClass(Class<?> clazz)
Adds a
Class object to the set of classes which shall eventually be included in the jar file. |
JarFileCreator |
addPackage(String p)
Manually specify the package of the dependencies.
|
JarFileCreator |
addPackages(String[] packages)
Manually specify the packages of the dependencies.
|
void |
createJarFile()
Creates a jar file which contains the previously added class.
|
public JarFileCreator(File outputFile)
outputFile - the file which shall contain the output data, i.e. the final jar filepublic JarFileCreator addClass(Class<?> clazz)
Class object to the set of classes which shall eventually be included in the jar file.clazz - the class to be added to the jar file.public JarFileCreator addPackage(String p)
p - the package to be included.public JarFileCreator addPackages(String[] packages)
packages - the packages to be included.public void createJarFile()
throws IOException
outputFile which has been provided to the constructor. If outputFile already exists, it
is overwritten by this operation.IOException - thrown if an error occurs while writing to the output fileCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.