Java Application Development on Linux
|
5.10. Return to the Source: The Java Decompiler
Java includes a decompiler of sorts called javap. It is sometimes referred to as the "class file disassembler." We titled this section "Return to the Source," but it is a bit misleading; javap simply provides a way to examine the members and methods of a compiled Java class[24] even when you do not have its source code. [24] In Chapter 7 we will introduce gcj, the GNU Compiler for Java, which compiles Java to native machine code. javap is useless with such a file. It deals only with JVM bytecodes as documented in Sun's JVM Specification. The javap command takes the same access-modifier command-line arguments as javadoc (-public, -protected, -package, -private) to determine which attributes and methods are to be reported. An additional switch, -c, causes the bytecodes of methods to be reported. For details, see Sun's documentation for javap.[25] [25] http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javap.html Example 5.19 shows what you get if you run javap -c on our FetchURL example. |
|