0

I try to print out the readable java bytecode to see the monitorenter and monitorexit to study about the deadlock and synchronization instruction set but I don't know what the java command or binary that I should use to get the readable java bytecode.

1
  • 4
    javap -c <classname> Commented Dec 21, 2013 at 10:01

1 Answer 1

3

Use the javap command, for example:

javap -v SomeClass.class

Example output:

19:23:56 (brettw) [dev] hikari$ javap -v HikariPool.class
Classfile /Users/brettw/Documents/dev/HikariCP/core/target/classes/com/zaxxer/hikari/HikariPool.class
Last modified Dec 19, 2013; size 11754 bytes
MD5 checksum 00e0441d0aad3bad1f4e7a67f6043b9c
Compiled from "HikariPool.java"
public final class com.zaxxer.hikari.HikariPool implements com.zaxxer.hikari.HikariPoolMBean
  SourceFile: "HikariPool.java"
  InnerClasses:
     #384; //class com/zaxxer/hikari/HikariPool$1
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
Constant pool:
#1 = Class              #2            //  com/zaxxer/hikari/HikariPool
#2 = Utf8               com/zaxxer/hikari/HikariPool
#3 = Class              #4            //  java/lang/Object
#4 = Utf8               java/lang/Object
#5 = Class              #6            //  com/zaxxer/hikari/HikariPoolMBean
#6 = Utf8               com/zaxxer/hikari/HikariPoolMBean
...
Sign up to request clarification or add additional context in comments.

1 Comment

You usually want -c -p.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.