Javatools

Here is the public domain source code for some command line tools that I use when programming in Java.

ImportGen

ImportGen reads a .java source file and generates a list of import statements that might be needed in the source file.

Use it like:

  prompt$ java com.profcon.javatools.ImportGen YourSource.java

It writes a sequence of import statements to its standard output.

The source is ImportGen.java

MethodByClass

MethodByClass integrates the method information that might be obtained by applying javap to a class and all its interfaces and superclasses. This shows where methods are introduced and overridden.

Use it like:

  prompt$ java com.profcon.javatools.MethodByClasss AnyClass

See this example.

The source is MethodByClasss.java

ListClasses

Based on the classpath under which it is invoked, ListClasses outputs all the classes in the classpath. Each class is on a separate line, followed by the classpath entry from which it was found.

Use it like:

  prompt$ java com.profcon.javatools.ListClasses

To discover if the same class is in the classpath twice, use something like:

  prompt$ java com.profcon.javatools.ListClasses | awk '{print $1}' | sort | uniq -d

The source is ListClasses.java

Copyright (c) 2001 .Profile Consulting, Inc. All rights reserved.