Projects‎ > ‎

Java Classfile Python Module

A Python module for inspecting a Java class file. May eventually be trained to behave like the javap utility shipped with most Java SDKs.

Available at

Why examine Java binaries in Python? First, I am often asked why I don't use the introspection API in Java to find the information I want. The answer to this is that those API do not expose nearly the depth of information I am interested in obtaining. Why not write a disassembler for Java in Java? Because I hate programming in Java, that's why. Typical use of this project will always be running outside of a Java virtual machine, thus the choice of language for writing the utilities and modules is very flexible. Python is very easy to develop rapidly in, and I find it to fit with my thinking style and the concept for what I want the modules to do comes together. Python will operate on a wide variety of systems, and it can be hooked easily into a number of other languages if it becomes necessary to do so.

There is no guaranteed API stability for this project until it has a 1.0.0 tagged release. Methods, modules, classes, etc can change at any time, so beware! With that said, I do believe that there should eventually be a stable interface, and once everything is working I will look at what I have wrought and do my damnedest to make it coherent, and then set some if it in stone.


I'd like to come out of this project with the following
  • a module for unpacking class file data
  • a module for packing class file data (for generating my own classes, etc)
  • a classinfo utility (mimicking the javap utility) using my own modules
  • a classdiff utility that will show the deltas between two compiled classes
  • maybe some sort of super-minimal compiler targeting the java runtime

Additionally, I have begun looking into some of the metadata associated with JAR files, and would like the following
  • a module for reading the MANIFEST.MF format (which has some quirks)
  • a module for creating the cryptographic checksums and appending the sections into a manifest
  • a module for signing and verifying a JAR (mimicking the jarsigner utility)
  • a jarinfo utility that would show both manifest data, and data compounded from the classes contained
    • packages, classes, methods, fields provided by the JAR
    • packages, classes, methods, fields required by the JAR
  • a jardiff utility that would show the deltas of the metadata, signing, contained classes (using classdiff) and contained non-classes


Luckily in this endeavour, I am not banging my head against some unknown format. The Java class file format is published openly.