Norm's Class references checker
Design
This program is an attempt to allow a programmer to verify that
all the files for a program are in a jar file. It does this by
openning a selected jar file and having the user select the starting
class file. (For Java2 this could be retrieved from the manifest.) It
then reads the class byte codes extracts all the referenced classes
from the Constant pool. These classes are then searched recursively
for the classes they reference. There are control options to prevent
searching classes in the java or javax packages. The results are
displayed in a TextArea.
The Window
The programs window has a menubar (see below), input fields to
enter a class name and a jar file name, a row of control buttons and
a Text area log to display the search results in. The radio
buttons: Classpath, Use jar and Class File
control whether the
class search is done using the classpath, jar file(s) or from user
setable classpath(s). You would
use the Classpath search when in development and have the classpath
set correctly. The Use jar search only looks in the jar
file(s) given.
- Class name: Enter the class name to start the search.
Clicking the Choose button with Use jar will list all the
files in the jar file for you to choose the class name from.
- Jar filename: Enter the jar filename here. Only enabled
if Use jar set.
- Classpath - Search will be done with Class.forName() to
get classes from classpath
- Use jar - Search will be thru contents of jar file(s)
given.
- Class File - Reads chosen class file and uses its own
classpath to find other classes. See Options|Set
classpath... to set paths to use
- Search - To start the search
- Clear log - clears text area log
- Up - Move the text area up one section. (When output
exceeds ~ 24K)
- Down - Move the text area down one section.
Usage
The easiest way to invoke this program is to set the "Application
to perform action" in the Window Explorer's
View|Options|Filetypes menu for the jar filetype. For
example:
java.exe -cp <path>CheckClassRefs.jar
CheckClassRefs -jar "%1"
Menu Items
- File
- Open props file... - Opens a properties file where
previous values are saved.
- Save List - Writes a displayed list of classes to a
disk file
- Save Log - Writes the Text area log to a disk
file.
- Close - exits program
- Edit
- Find - does find in log for a string
- Find Next - continues search for string
- Sort list - Sorts list of displayed class names
- List Unreferenced classes - Lists names of classes in the
jar file that weren't referenced.
- Options
- Show Unique names only
- Show java(x) classes - Will attempt to list the
java classes used
- Show all classes - Will attempt to list all classes
referenced. Be careful as this can generate lots of
output.
- Show referenced F|M|I - Allows listing of Fields,
Methods and Interface Methods referenced.
- Show source - Displays jar file class came
from.
- Add extra jar... - This builds the "ClassPath" of
jar files to be searched. This list will be kept in the
currently open properties file.
- Set classpath... - Gets paths to be used as
classpath with the Class File checkbox. Paths should be
separated by ; and end with path separator.
- Help
- About - displays info
- Help topics - displays this file
Last modified March 30, 2001