JODE is a java package containing a decompiler and an optimizer for java. This package is freely available under the GNU GPL. The bytecode package and the core decompiler is now under GNU Lesser General Public License, so you can integrate it in your project.
The decompiler reads in class files and produces something similar to the original java file. Of course this can't be perfect: There is no way to produce the comments or the names of local variables (except when compiled with debuging) and there are often more ways to write the same thing. However, JODE does its job quite well.
The optimizer transforms class files in various ways with can be controlled by a script file. It supports the following operations:
- Renaming class, method, field and local names to shorter, obfuscated, or unique names or according to a given translation table
- Removing debugging information
- Removing dead code (classes, fields, methods) and constant fields
- Optimizing local variable allocation