commanderbond cryptosaurus image jdep spambuddy superstopwatch textscape textscape2 utilities xmogrify xql yago
jdep Finds all the files in a given classpath on which some input classes depend. For example:
$ java -jar jdep.jar --classpath jdep.jar:/tmp/classes uk.co.hcsoftware.jdep.Main
ns.TaskTimer uk.co.hcsoftware.jdep.BadClassFileException uk.co.hcsoftware.jdep.ClassFinder uk.co.hcsoftware.jdep.ClassFinder$ClassFile uk.co.hcsoftware.jdep.ClassFinder$FileClassFile uk.co.hcsoftware.jdep.ClassFinder$StreamHandler ... 23 dependencies from inputclasses: [uk.co.hcsoftware.jdep.Main] (21 classes in classpath) 250ms to find dependencies 266ms in total
.java
file and import the interface. javac
will inline the values of those variables into your .class
file; so whereas your .java
file depends on the interface, your .class
file does not:
public interface MyConstants{
public static final int ONE=1;
}
public class MyClass{
private int one=MyConstants.ONE;
}
Class.forName(..)
and ClassLoader.loadClass(..)
which have been inserted by javac
, rather than by the user. It seems that anywhere you put a foo.class
variable in your sourcefile, javac loads the class in a static initializer with forName..
Not sure how to eliminate this, but suggest cross-referencing the list with all the .java files that contain these methods..
$ java -jar jdep.jar
usage: jdep options inputclass1 [inputclass2.. inputclassn] prints out the fully-qualified names of all the classes referenced by the input class(es) -c,--classpath <arg> * classpath value (same syntax as -cp arg to java ;-de limited) -i,--ignore <arg> ignore any classes whose fully-qualified name starts with one of these values (:-separated list) -n,--norecurse just resolve the input classfile, don't attempt to r esolve the classes it references -o,--only <arg> only include classes whose fully-qualified name star ts with one of these values (:-separated list) -q,--quiet just print out resolved classes (or error message if bad invocation) -no extra info -s,--sort sort output classnames lexically -w,--warndynamic look for invocations of Class.forName(..) and ClassL oader.loadClass(..) and warn about them [nothing is printed in --quiet mode] * required options
$ java -jar jdep.jar -s -i java -c cglib-nodep-2.1_3.jar;spin.jar spin.CGLibProxyFactory
$ java -jar jdep.jar -sw -i java:javax:org.w3c -c /tmp/classes:/tmp/jars/jdom.jar:/tmp/jars/swing-layout-1.0.jar uk.co.hcsoftware.commander.Main
$ jdep -qs -o uk.co.hcsoftware -c /lib/abc.jar uk.co.hcsoftware.commander.Main | grep -v '\$' | sed -e 's/\./\\/g' -e 's/^/load \\fo_hcs\\java\\src\\/g' -e s/$/.java/g >> config.spec
$ jdep -c jdnc-0_7-all.jar -s org.jdesktop.swing.JXTable | grep -v \$ | sed -e 's/\./\\/g' -e 's/$/.java/g' > sourcefiles
$ Treecopy /tmp/jdnc/src sourcefiles /tmp/to