What is reJ?

reJ is a graphical tool for manipulation and inspection of .class files of the Java platform.


What do I need reJ for?

reJ probably shouldn't be a regular part of any development cycle. However, it can be very handy for various things.

  • Understanding the bytecode of the Java platform
  • Visualizing the relationship between Java sourcecode, bytecode mnemonics and the compiled Java binaries
  • Quick browsing through a binary distribution (for example, finding a version field of a class in a jar: Open the jar file with reJ, do a search for "version" and see the results)
  • Java-intelligent compare of classes / jar files / folders
  • Very small or temporary modifications to classes where there is no source available
  • Debugging classes where there is no source available

To get a more comprehensive idea, see the features of the latest version of reJ.


How to run reJ?

Download the binary release of reJ: rej_vx.x_bin.zip from the Files section of the SourceForge project.

Unpack the zip archive. It contains an executable .jar file. If you wish to use the debugging funcionality of reJ, you will have to execute reJ manually, specifying the path to the tools.jar library of your JDK in the classpath, for example:

java -cp rej.jar;tools.jar net.sf.rej.gui.MainWindow


How do I use reJ?

See the Hello World -tutorial to get a basic grasp of the GUI features.


Can I use the reJ library programmatically?

In theory: Yes. The package net.sf.rej.java package (and sub packages) can be used by anyone.

In practice: This something that is certainly planned to be made more accessible, but at the moment there are several obstacles to accesing the reJ manipulation API, namely: The library part of reJ is not packaged separately, the javadocs (where present) lack in quality, there is no other documentation describing the use of the API, there aren't enough unit tests to guarantee that the API works for anything that the reJ GUI doesn't do and the contracts of the classes haven't been defined sufficiently well.


Is there a commandline interface to reJ?

No. There are plans to create one, but at the moment it's still in under construction.


Is reJ like cglib?

Not really. Both projects deal with bytecode manipulation, but have completely different focuses. cglib is a high-level API for bytecode manipulation, which uses Apache Jakarta BCEL for the bytecode manipulation part. reJ is a low-level bytecode manipulation API (similar to BCEL) which has a graphical user interface for visualizing and manipulating bytecode (and other .class file properties).


Does reJ support visualization and modification of .class files created from non-Java sources (such as Scala) and files created by modifying .class files through some library, obfuscator (and so on)?

Absolutely. reJ can handle any kind of valid Java class file. Actually even many forms of invalid class files are no problem.


Can reJ be used to visualize the relationship between Java source - Java bytecode mnemonics - the compiled binary?

Currently (version 0.7) supports visualizing the relationship between the compiled binary (a hex view of the binary) and the Java bytecode mnemonics; the user can navigate through the mnemonics and the corresponding binary is highlighted in the synchronized view.

The current version also shows the corresponding Java source file numbers in the bytecode editor (provided that this information is preset in the class file).


What does it do?

reJ is a graphical tool which opens .class files (or archives, or folders) and displays the compiled Java bytecode in a (relatively) readable form, however without trying to decompile it into a Java source. The readability is improved by syntax highlighting and context sensitive hints and navigational tools. reJ can also edit virtually any properties of the .class file or it can create a new class file out of scratch.


Can I compare two classes/archives?

Yes, reJ offers a diff-like functionality for comparing two sets (which are essentially class files, folders or archive files) and shows the differences in a tree-like format, visualizing the differences between any two class files which exist in both sets.