A graphical class viewer utility.
The JDK is freely downloadable from Oracle and contains all the necessary tools to compile, run and debug Java code. The one downside is that the free tools are command line driven. Some of the tools could benefit greatly from a graphical user interface. In particular the JDK's javap utility is one such tool. This utility mimics javap's ability to list a class's methods and attributes while presenting the results via a user friendly interface.
Upon application startup you will be presented with the following window:
By default, the cursor is placed in the edit box. Enter a fully qualified Java class name that is located on the classpath and press the Enter key to view information about the class. For example, the windows below show the before and after views of the user entering java.lang.String as the class name.
Note, the window on the bottom lists the entered Java class name in the drop down listbox located directly beneath the edit box. This facilitates selection of any previously entered class name without having to retype the same class name in the edit box. The output is rendered as a tree view with the class's constructors, methods and attributes rendered as leaf nodes under the class definition root node. Class names not found on the classpath will display an error message and will not be added to the drop down listbox. Class files (files ending in a .class extension) not on the classpath may be selected via the File->Open... menu item with the output rendered as previously described.
The Byte Buddy project was added as a dependency to this project in order to create placeholder classes that are not found on the classpath or derivable from the custom file class loader when using the utility's File->Open... feature. This allows the utility to display the tree output without causing an error. When the output displays a non-fully qualified class name, that is a signal that Byte Buddy was used to create and load a placeholder class. The project has also been Mavenized and as such can be built via the following executed from a terminal window
mvnw package
or
./mvnw package
on MacOS/Linux environments.
The command will create the following two JAR files in the project's root folder target directory.
- class-viewer-0.0.1-SNAPSHOT.jar
- class-viewer-0.0.1-SNAPSHOT-jar-with-dependencies.jar
The class-viewer-0.0.1-SNAPSHOT-jar-with-dependencies.jar file is an executable JAR that includes the Byte Buddy dependency in the JAR. Run the following from the terminal window to execute the application
java -jar class-viewer-0.0.1-SNAPSHOT-jar-with-dependencies.jar