sandos
sandos

Reputation: 852

Is it possible to view dynamically generated bytecode in eclipse?

I know of several solutions for files that end in ".class", where you can use the ByteCode Outline plugin, or the Bytecode Visualiser plugin, or even the built-in "javap-like" viewer for classfiles.

But I would like this ability for runtime-generated code while debugging! What I am trying to achieve is to see the actual generated code from a clojure call executing. This uses ASM to generate classes on the fly.

Upvotes: 3

Views: 499

Answers (2)

xor_eq
xor_eq

Reputation: 4073

Apart from JAD, there are other tools. One's called JD (Java Decompiler). It also has an eclipse plugin and is a little better than JAD since it supports Java 5, JAD only supports Java 4 (as far as I know there hasn't been any development on JAD since 2001 or something). A tool that seems to be supporting Java 6 is DJ Java Decompiler, but I haven't tested that yet.

And I don't know if any of these tools actually support on-the-fly-generated code, on the other hand I don't really see why they should not.

Upvotes: 0

user545199
user545199

Reputation:

Using the eclipse IDE, you can combine JAD(a java decompiler) with the JADClipse plugin to decompile your class files on the fly whenever the debugger attempts to open a class file that has no linked source. Without eclipse, you can use JAD as an independant executable, but it is less user friendly.

JAD will generate the java source for a class file even if it was built with a java assembler. This is possible because the java language is close enough to the functionality of the jvm. The only class files this wont work on is ones that have been run through an obfuscator to prevent decompilation

Upvotes: 1

Related Questions