MiniInstaller
The mini installer is the selfextracting jar component of AntInstaller with a few modifications
It simply extracts all the files in the Jar to a user selected directory.
It works on the command line or with a GUI if possible.
It is available as a separate download.
Usage
Simply place
org.tp23.mini.MiniInstaller.class
and
org.tp23.mini.ProgressIndicator.class
in the Jar and add a
/META-INF/MANIFEST.mf
with the Main-Class attribute set to
org.tp23.mini.MiniInstaller
.
If the manifest includes an attribute
Overwrite-Files
with any value
the installer will overwrite existing files.
LookAndFeel
If the manifest can include an attribute
Look-And-Feel
with a value
that specifies a look and feel on the claspath that look and feel will be used.
As with AntInstaller a modified verison of the JGoodies look and feel is included.
This is cut down to 150K (after compression) since only the file chooser and
JOptionPane are used.
If it is still too much just don't include the package
org.tp23.jgoodies
in the installer
and the default LookAndFeel will be used.
Extending MiniInstaller
A Hook class can be implemented in the default package that must implement
this imaginary interface.
interface Hook{
public int exec(MiniInstaller installer, boolean graphicsEnv);
}
The interface is imaginary since it does not exist and is not required on the classpath
.Reflection is used to find the method.
The Hook should never throw exceptions.
MiniInstaller.isGraphicsEnv()
can be used to determine if there is a graphics environment.
MiniInstaller.printXorTextWarning(String)
can be used to print a message.
MiniInstaller.getArchiveFile()
returns a file handle on the Jar being extracted.
All classes in the package org.tp23
including ProgressIndicator,MiniInstaller,Hook and the image
resources/extract-image.png are not extracted.
If you add other classes to Help your Hook class they should be added to the
package org.skip
and they will not be extracted.