
Pure-Go Java Decompiler and Serialization Operator
A portable, pure-Go Java toolkit — extracted and trimmed from yaklang — focused on four things:
.class, Java archives (.jar / .war / .ear / .aar /
.par / .jmod / .zip), and JDK runtime images (.jimage /
$JAVA_HOME/lib/modules) → readable Java source, including nested JARs inside
WAR/EAR/AAR and fat JARs..dex / .apk / .apks / .xapk / .apkm /
.aab → deterministic .jar, or directly to readable Java source, without
invoking an external dex2jar tool..class file (constant pool,
fields, methods, version, access flags).Built for portability and embedding:
javajive facade package wraps all four
capabilities; the sub-packages remain available for advanced use.decompile, dex2jar, classinfo, and serial
subcommands, built on the standard library..class / .jar and JDK-serialized blobs, then verifies JavaJive against them.
Required PR CI stays pure Go and consumes hash-pinned class/JAR/DEX/JImage corpora
(see HARNESS-WORKFLOW.md).utils / codec / log / go-funk are
reimplemented as a minimal, self-contained internal/ core.The complete 38-JAR differential audit reports zero recorded regressions against the fixed baseline: all 20 previously compile-clean JARs are retained and 26 now compile in full. Baseline defects and 4 existing method stubs remain visible. See the per-JAR results and reproduction.
250 isolated semantic round trips record compilation, JVM verification, stubs and runtime equality separately; original application classes are absent from rebuilt classpaths. Manual extended workflows run the semantic and historical JDK audits; required PR CI runs sealed pure-Go algorithm, race, coverage, and fixed-corpus gates. These checks do not prove equivalence of every library method. See the implementation and remaining boundaries.
The following figures were reported for v0.3.0 on 2026-09-05. They are not current-version acceptance results or proof of behavioral equivalence.
Measured on 34 real-world jars (18,759 flattened units) via decompile → javac --release 8
recompile → repackage → JVM verify:
Outer$Inner.java)
recompile with zero javac errors, and 0 syntax errors across all 34 jars (a CI-enforced
hard assertion, so no type error can hide behind a lexer failure).-Xverify:all per-class verification passes end-to-end (codec is byte-identical to the
original jar under a call differential). Locked in provenClean.See BENCHMARK.md for the full methodology, per-jar tables and reproduction commands.
A separate, CI-gated corpus exercises modern language targets rather than the
historical Java 8 libraries: Java 21 records/sealed types/pattern switches/switch
expressions, control-flow torture, Java 8 enum bodies, a 100-class scale JAR,
multi-release and modular JARs, and the packaged irreducible fixtures. Each case
is decompiled, tree-recompiled, verified with java -Xverify:all, and compared
against original runtime output. See
test/complexjar/REPORT.md for the inventory, fixed
defects and remaining boundaries.
# CLI
go install github.com/yaklang/javajive/cmd/javajive@latest
# Library
go get github.com/yaklang/javajive@latest
Or build from source:
git clone https://github.com/yaklang/javajive
cd javajive
go build -o javajive ./cmd/javajive
Requires Go 1.22+.
javajive <command> [arguments]
Commands:
decompile decompile .class files, Java archives, JDK runtime images, or Android containers into Java source
dex2jar convert DEX/APK/APKS/XAPK/APKM/AAB input to a deterministic JAR
jimage2jar convert a JDK runtime image (lib/modules, .jimage) to a JAR view
inspect read-only inventory and best-effort analysis of Java/Android artifacts
classinfo print the structure of a .class file (version, fields, methods)
serial Java serialization tools (subcommands: tojson, fromjson)
version print the version
help show help
Input is detected by content magic first, archive structure second, and the filename extension last, so renamed artifacts keep working.
| Input | Handling |
|---|---|
.class, directory | one class, or recursive .class decompilation |
.jar / .war / .ear / .zip | Java archive; nested .jar/.war/.ear/.par/.jmod/.zip layers are decompiled in place |
.aar | Android library archive; classes.jar and libs/*.jar are decompiled |
.par | Java archive (extension fallback when the ZIP has no stronger marker) |
.jmod | JDK module image; the four-byte JM\x01\x00 prefix is stripped automatically |
.jimage / $JAVA_HOME/lib/modules | JDK 9+ runtime image; converted to a package-layout JAR view. Uncompressed, zlib zip, and compact-cp resources are supported |
.dex | raw DEX |
.apk | root classes.dex, classes2.dex, ... multidex entries |
.apks / .xapk / .apkm / .apkx | nested split APKs; universal.apk is preferred when present |
.aab | Android App Bundle; every <module>/dex/classes*.dex is translated |