This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.
This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.
Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.
Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.
You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.
Please do not email me about this project without reading the disclaimer above.
Various people have tried to write a replacement for jar.exe. The results have been disappointing. Attempts are buggy or they are not integrated into various building schemes such as Ant and Maven. Projects are abandoned leave users high and dry. Jar.exe, Maven and Gradle all include many more classes that are ever used. Basically Maven and Gradle include entire jars if even one class in the jar might be used. This causes distributables to bloat to several times the size they need be.
There are four major problems with jar.exe:
This project will help with (1), (2) and (3) but not (4). I suggest a much less ambitious project than others have attempted. I suggest a jar pruner. It examines a finished jar and chases the dependencies and produces a list of jar members that are not on the dependency tree. These may be:
It is up to the programmer to decide which classes fit in which categories and perhaps prune some classes from the lists given to jar.exe.
This simplifies the task of jar building. The programmer can throw the kitchen sink into the jar, then use jarpruner to shave it back prior to distribution. There is no need to shave it until the program is stable. Unused classes at an intermediate stage may be used later.
To implement this project, you don’t have to build manifests, digests or select which files to include. This makes for a much simpler coding task. You don’t have to parse any command files. Your program does not modify any files. It cannot do any serious damage.
Your input consists of a list of the key classes you load dynamically and the resources. The output consists a list of the classes that have to be present because they are either referenced, a list of classes indirectly referenced by dynamically loaded classes and a list of the orphans not referenced that may be safely removed. You use this information to create a slimmer manifest. If you chop too much or not enough, you will find out when you run jarprune on the slimmed jar. Everybody who posts a jar or the web or distributes one could make use of this utility. It is compatible as a final step of all build systems.
Further, it could warn you of indirectly referenced classes not present, saving you finding out later when in the course of some execution path the class is finally used.
After you have successfully tackled this project, you might try taking over the defunct GenJar project and debugging it and providing an ANT (A Neat Tool), standalone and Maven interface. Then your utility builds the jar without using jar.exe given just a list of resources and dynamically loaded classes. From dependencies, you can automatically include classes the dynanmically-loaded classes use.
This page is posted
Optional Replicator mirror
Please read the feedback from other visitors, or send your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Your face IP:[184.108.40.206]
You are visitor number|