public class SuperJar extends Object
This class has a main
method, and is designed to be invoked
from the command line.
Constructor and Description |
---|
SuperJar(File[] jarFiles,
File[] flatFiles,
String[] jarExcludes,
String[] entryExcludes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
Writes a new jar or zip file based on the contents of an existing
jar file and the jar files referenced by its manifest.
|
void |
writeSingleJar(OutputStream out)
Writes the data from this object to a single jar file combining the
contents of all the dependencies.
|
void |
writeZipOfJars(OutputStream out)
Writes the data from this object to a zip file containing all the
top-level and dependency jars as individual jar files in the same
directory.
|
public SuperJar(File[] jarFiles, File[] flatFiles, String[] jarExcludes, String[] entryExcludes) throws IOException
The entryExcludes
values are full pathnames
with no leading "/", interpreted as follows:
jarFiles
- top-level jar files containing files and dependenciesflatFiles
- files for inclusion at top level of outputjarExcludes
- names of jar files which may be named as class-path
dependencies but which should not be included in the resultentryExcludes
- jar file entries which should be excluded
from the resultIOException
public void writeSingleJar(OutputStream out) throws IOException
out
- destination streamIOException
public void writeZipOfJars(OutputStream out) throws IOException
out
- destination streamIOException
public static void main(String[] args) throws IOException
Usage:
SuperJar [-oj outjar] [-oz outzip] [[-xjar jar] -xjar jar ...] [[-xentry entry] -xentry entry ...] jarfile [jarfile ...]
If the -oj
flag is given, it supplies the name of
a monolithic jar file to output.
-o
is a deprecated synonym for -oj
.
If the -oz
flag is given, it supplies the name of a zip
file to output. This zip file will contain all the named and
referenced jar files in a single flat directory.
The -xjar
flag may be supplied one or more times to define
jarfiles which should not be included, even if they are referenced
in the manifest's Class-Path entry of a jar file which is included.
The exclude
argument thus defined is the name, optionally
with one or more prepended path elements of the jar file to be
excluded (e.g. axis.jar or axis/axis.jar would both work).
-x
is a deprecated synonym for -xjar
.
The -xent
flag may be supplied one or more times to give
full paths for jar entries which should not be included in the output.
These are interpreted as follows:
The jarfile
argument(s) will be combined to form
the output file, all their contents and those of the jar files
referenced in their Class-Path manifest entries will be used.
The manifest of the first one will be used as the manifest of
the output file (though its Class-Path entry will be empty).
Zip files can be used as well, they work the same but have no
manifest.
Any flat-file
arguments will be included as files
at the top level of the output jar or zip file.
args
- an array of command-line arguments as described aboveIOException
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.