ShowDeps is a simple tool to print out the static dependenices for a given set of JAR, class files, or combinations of. This tool supports a -id option to specify the given module identifier and it will generate the module declaration (module-info). It also supports an -ignore option to ignore references to classes listed in the file (including .classlists created by the ClassAnalyzer tool).
java ShowDeps [-L ] [-id ] file...
   where <file> is a class or JAR file, or a directory
If -id option is specified, it will generate the module declaration.

Example usages:
  java ShowDeps Foo.jar
  java ShowDeps -id "foo@1.0" Foo.jar
  java ShowDeps -L modulelibrary Foo.jar
  java ShowDeps -ignore base.classlist Foo.jar
  java ShowDeps -ignore base.classlist -ignore jaxp-parsers.classlist <dir>
For example, to generate module declaration for SwingSet3:
$ java ShowDeps -id "swingset3 @ 1.0" swingx.jar swing-worker.jar AnimatedTransitions.jar TimingFramework.jar AppFramework.jar          
module swingset3 @ 1.0 {
    requires jdk.base;
    requires jdk.desktop;
    requires jdk.jdbc;
    requires jdk.jndi;
    requires jdk.logging;
    requires jdk.prefs;


The ClassAnalyzer tool analyzes the class dependencies among the input class files. It parses the class files, finds all class references, assigns classes to modules per the specified configuration files and then generates a set of reports for each module, including the list of classes, the list of resource files, and its dependencies on classes from another module. This tool supports a -config option to group classes in more than one modules and also a -moduleinfo option to generate source files.


  1. Class files to be analyzed
  2. Input configuration file to include/exclude classes in modules
  1. ClassAnalyzer generated reports: *.classlist, *.resources, *.dependencies
  2. for modules
The ClassAnalyzer can only find static dependencies from the bytecode but not implicit dependencies which include classes loaded by Class.forName, service providers, constants inlined by the compiler, and JNI_FindClass. In addition, it does not parse the annotations.

ClassAnalyzer's Configuration File

module swingset3 {
    // include classes in this module
    include com.sun.swingset3.**;

    // include resource files in this module
    include META-INF/demolist;

    // main entry point
    class com.sun.swingset3.SwingSet3;
The syntax is similar to Directives are:

JDK Modularization

The ClassAnalyzer tool is used in the jigsaw modules build to analyze the class dependencies amongst the JDK classes and generate the files for JDK modules as a post-processing step. This is an interim solution enabling us prototype a modular JDK and make change to the module definitions during the course of our development, for example, synchronizing the on-going JDK development with the jdk8 repository. Utimately, we will restructure the source tree so that JDK modules will be compiled in the modulepath that can be used for development and the image build. Source tree restructuring has a big impact on all JDK engineers and thus we should do this when the module definitions and graph are close to final to minimize the disruption to the teams.

The configuration file for JDK is at: modules.config and


Usage: ClassAnalyzer <options>
        -classpath     classpath where classes and jars will be parsed
        -config        config file
                       This option can be repeated to specify multiple config files.
        -jigsawLibrary module-library-path
                       Default is the system module library if present.
        -moduleinfo    output dir for
                       If not specified, no will be generated.
        -output        output dir for the generated reports
        -properties    module's properties
        -version       version of the modules