0.1.0 • Published 1 year ago

@run-slicer/javap v0.1.0

Weekly downloads
-
License
GPL-2.0-only WITH...
Repository
-
Last release
1 year ago

javap

A JavaScript port of the javap class file introspection and disassembly tool.

Based on this revision of the OpenJDK 21 source tree.

Example

const fs = require("fs");
const { disassemble } = require("./javap.js"); // get it from the dist/ directory or jsDelivr

const data = fs.readFileSync("./your/package/HelloWorld.class"); // read a class file
console.log(await disassemble("your/package/HelloWorld", {
    source: async (name) => {
        /* provide classes for analysis here, including the one you want to decompile */

        console.log(name); /* internal name, e.g. java/lang/Object */
        return name === "your/package/HelloWorld" ? data : null /* class not available */;
    },
    options: ["-v"], // options as passed into the javap CLI
}));

Or see the browser-based proof-of-concept in the docs directory.

Licensing

The supporting code for this project is licensed under the MIT License (supporting code. The javap tool is licensed under the GNU General Public License, Version 2 with Classpath exception.

This project is not affiliated with, maintained or endorsed by the OpenJDK project in any way. Do NOT report issues with this project to the OpenJDK issue trackers.

0.1.0

1 year ago