Put into one sentence, JavaClass is a general purpose framework for
Byte Code Engineering.
This API is intended to give users a
convenient possibility to read, create, and manipulate (binary) Java
class files (those ending with .class). Classes are
represented by JavaClass objects which contain all the symbolic
information of the given class: methods and fields, in particular.
Such objects can be read from an existing file, be transformed by the
application (e.g. a class loader at run-time) and dumped to a file
again. The JavaClass library may be also useful if you want to learn
about the Java Virtual Machine (JVM) and the format of Java .class
files. It was mainly designed to be used in other projects in order to
handle the creation of Java class files with more comfort.
For example, you could manipulate a class file, e.g. for writing
an obsfuscator. (An ``obsfuscator'' mangles the information contained
in a class file to a human-unreadable format. This is useful when you
want to keep someone from decompiling your classes). Vice versa, if
you are writing a compiler that shall produce Java byte code, you can
construct JavaClass objects conveniently with this package and then
dump them to a file.
As a first demonstration, "listclass.java" is included in this distribution, which displays the contents of the given class files. You can use the switches "-code" to show the disassembled code and "-constants" to print the whole constant pool. (Which may be quite long!)
The ClassGen API helps compiler writers to produce byte code, i.e. Java class files. Others may want to load classes, modify them and dump them back to a file. Take a look at the Mini language I wrote for demonstration purposes:
You can download the latest version as a gzipped tar file or as a ZIP file. You should prefer the former even for Windows, because it is much smaller and can be unpacked with WinZip as well.
Files | Mirrors | ||
---|---|---|---|
Latest version (Precompiled + docs) |
Gzipped Tar-File (~600K) | ZIP-File (~1.3M) | |
Latest version (Source only) |
Gzipped Tar-File (~150K) | ZIP-File (~300K) | |
Old version | Gzipped Tar-File | ZIP-File | |
Mini | Gzipped Tar-File | ZIP-File | |
Technical Report | Gzipped PostScript, PostScript | Gzipped PDF, PDF | |
Paper | Gzipped PostScript, PostScript | Gzipped PDF, PDF |
JavaClass was downloaded 2968 times since Thu Nov 26 1998. I'm am looking for some official mirror sites, so if you've got some space left, please let me know.
Please tell me, if you find this tool helpful. I'd also be interested in what kind of projects you use it.
JavaClass is © 1999 Markus Dahm, under the terms of the GNU Library General Public License. See COPYING.html for more.
Last change 5.8.99: Send bug reports and suggestions to dahm@inf.fu-berlin.de (Markus Dahm)