Minimal set of classes: deps4j and minify-weka

For targeted Java applications, e.g., embedded ones, you quite often don’t need the full range of classes that a library comes with. The same applies to Weka. Quite often, you can get away with just the core data structures and a few algorithms and filters. For that purpose, I’ve created a couple of libraries/tools:

  • deps4j – utilizes the jdeps tool (part of a JDK) to determine the minimal set of classes that are required to make a supplied list of class names compile. However, not all classes can be determined that way, e.g., onces instantiated through reflection etc. For that purpose, you can also supply an additional list of supporting classes (which won’t get analyzed, simply added to the output).
  • minify-weka – this tool allows you to minify Weka using the deps4j library. It uses a Weka build environment as input and creates a new one with only the minimal set of classes, based on the required classes and additional ones that cannot be determined automatically. Caveat: at the time of writing, the Weka ant build script still requires the internal/external package directories to be present (though not actually required). This requirement will hopefully become optional in the near future.

Leave a Comment

Your email address will not be published. Required fields are marked *