Understanding Java Byte Code

前端 未结 6 2303
长发绾君心
长发绾君心 2021-01-30 15:05

Often I am stuck with a java class file with no source and I am trying to understand the problem I have at hand.

Note a decompiler is useful but not sufficient in all si

6条回答
  •  误落风尘
    2021-01-30 15:22

    Rather than looking directly at the Java bytecode, which will require familiarity with the Java virtual machine and its operations, one could try to use a Java decompiling utility. A decompiler will attempt to create a java source file from the specified class file.

    The How do I “decompile” Java class files? is a related question which would be informative for finding out how to decompile Java class files.

    That said, one could use the javap command which is part of the JDK in order to disassemble Java class files. The output of javap will be the Java bytecode contained in the class files. But do be warned that the bytecode does not resemble the Java source code at all.

    The definite source for learning about the Java bytecode and the Java Virtual Machine itself would be The Java Virtual Machine Specification, Second Edition. In particular, Chapter 6: The Java Virtual Machine Instruction Set has an index of all the bytecode instructions.

提交回复
热议问题