Procyon is a Java decompiler written in Java, and it can be called directly from Java code. For example:
final PrintWriter writer = new PrintWriter(System.out);
try {
com.strobel.decompiler.Decompiler.decompile(
"W:\\Hello.class",
new com.strobel.decompiler.PlainTextOutput(writer)
);
}
finally {
writer.flush();
}
There is also a decompile()
overload that accepts a DecompilerSettings
instance, which you can use to toggle certain features and give the decompiler hints on how to resolve class dependencies. Feel free to contact me on BitBucket with any questions.