Facilitating the Development of Static Analyses

OPAL comes with a large number of tools to analyze and visualize various aspects related to Java Bytecode projects. These tools can be used as is or can be embedded into other tools. Some of the tools require Graphviz to visualize graphs which depict control- and data-flow information.

Java Bytecode Disassembler / Java Class File Finder

OPAL has a built-in Java Bytecode Disassembler which is also made available as a standalone tool and also as a plug-in for the ATOM text editor (ATOM - Java Bytecode Disassembler) .

In contrast to most existing Java disassemblers, OPAL generates an HTML document to provide better syntax highlighting and advanced interaction.

Screenshot of the OPAL Java Bytecode Disassembler in action: ATOM - OPAL Disassembler

To use the OPAL Java Bytecode Disassembler Java 8 is required.

Command Line Tool

Usage: java org.opalj.da.Disassembler 
       [-help will print the help and terminate]
       [-o <File> the name of the file to which the generated html page should be written]
       [-open the generated html page will be opened in a browser]
       [-source <File> a class or jar file or a directory containing jar or class files;
                     if no source files/folders are specified the current folder will be
                     searched for class files]* (can be specified multiple times)
       [-sourceJDK the current JDK/JRE is added as a source folder]
       [-noDefaultCSS the generated html page will have no CSS styling]
       [-noMethodsFilter the generated html page will have no embedded means to filter methods
                       (as a whole, the file will not contain any JavaScript code)]
       [-noHeader the generated output will have no header; 
                 the top level element will be <div class="class_file">...</div>
                 (automatically activates "-noMethodsFilter" and "-noDefaultCSS")]
       [-css <Source> the path (URL) of a CSS file (".csss")
                     which will be referenced from the generated HTML page]
       [-js <Source> the path (URL) of a JavaScript file (".js")
                    which will be referenced from the generated HTML page]
       [-showProgress shows the progress when searching for the class file]
       [<ClassName> name of the class for which we want to create the HTML page; if not 
                   specified the first class that is found on the given path is taken; this
                   is particularly useful if the source identifies a particular ".class" file]

Note, that the OPAL Disassembler is fast and can scan thousands of class files per second; this makes it also possible to use it to locate a certain class file. For example, if you want to find the jar which defines a specific class, e.g., java.util.HashMap$Entry, it is sufficient to specify the root folder of the JDK and let it automatically find the class for you. The generated HTML file will contain precise information where the class file was found. This also works if you specify the root of your .ivy or .m2 folders.

ATOM Plug-in

Using the ATOM plug-in, it is in particular possible to click on a type in a disassembled file to also disassemble the target type. This enable you to quickls navigate between ".class" files.


The bytecode Disassembler can be run programmatically as shown next:

val classFile : org.opalj.da.ClassFile = ...;
val html = classFile.toXHTML()
// println(html)
// org.opalj.io.writeAndOpen(classFile.toXHTML().toString, "ClassFile", ".html")

Running Tools which are part of the OPAL Suite

To use the tools, start sbt, change to the project OPAL-DeveloperTools project and call run. Afterwards, you'll see the list of tools which can be run.