GenJar scans the classpath looking recursively for classes to include in the jar. These it includes in the jar. Classes in the ext directory, by default, it leaves out of the jar.
You can force it to include certain classes or tell it not to include certain classes because they will be supplied at run time in an auxiliary jar.
This build script builds Biorhythms, a signed Applet. You make genjar known to the script with: <taskdef resource=genjar.properties /> Oddly there are no properties to speak of in genjar.properties, just the name of the Java class that extends Task to implement GenJar.
Here is how you would include a whole directory full of *.png resource images in your jar:You can use the <library command to unpack and include some other library jar inside your jar. Unfortunately, the <classfilter command has no effect on just what is included with the <library command. Everything is included, needed or not! You have to set up the jar to be included on the classpath, then use the <classfilter. You can use the <class command to include just the stuff from a library needed to support a given class. You can use the <classpath command if GenJar seems to be having trouble finding some auxiliary library.
In this example we persuade GenJar to include just the classes used by the TrueZIP library jar and bundle them in
You might want to recompile GenJar to fix bugs, to figure out how it works etc. You will have to add the Ant jars to the project. GenJar.jar does not have a main-class in the manifest. Ant learns about the genjar.properties file from the taskdef statement in the ant script. It reads it and discovers the class org.apache.tools.ant.taskdefs.optional.genjar.GenJar which extends the abstract Ant Task class. Ant can dynamically load Genjar with Class.forName.asSubClass .newInstance. Ant can then call GenJar’s methods as needed.
|
|
available on the web at: |
http://mindprod.com/jgloss/genjar.html |
optional Replicator mirror
|
J:\mindprod\jgloss\genjar.html | |
![]() |
Please email your
feedback for publication,
letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear
wording, broken/redirected link reports, suggestions to improve this page or comments to
Roedy Green :
| |
| Blog | Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[107.22.127.92] |
|
| Feedback | You are visitor number 18,157. | |