UltraEdit 是一款很好用的文本編輯器,很是推薦使用java
咱們能夠用編輯器來執行javap命令來分析class字節碼文件jvm
點擊 運行DOS命令 輸入編輯器
javap -v -p -c -s -l D:\esp\esp-portal\esp-portal-server\target\classes\test\jvmClass.classthis
後面class 是我本地文件命令行
而後界面會輸出字節碼結果code
Classfile /D:/esp/esp-portal/esp-portal-server/target/classes/test/jvmClass.class Last modified 2016-11-15; size 1095 bytes MD5 checksum 7a3b26fe550b25cb986906ad18ff619d Compiled from "jvmClass.java" public class test.jvmClass minor version: 0 major version: 50 flags: ACC_PUBLIC, ACC_SUPER Constant pool: #1 = Class #2 // test/jvmClass #2 = Utf8 test/jvmClass #3 = Class #4 // java/lang/Object #4 = Utf8 java/lang/Object #5 = Utf8 i #6 = Utf8 I #7 = Utf8 <clinit> #8 = Utf8 ()V #9 = Utf8 Code #10 = Fieldref #1.#11 // test/jvmClass.i:I #11 = NameAndType #5:#6 // i:I #12 = Utf8 LineNumberTable #13 = Utf8 LocalVariableTable #14 = Utf8 <init> #15 = Methodref #3.#16 // java/lang/Object."<init>":()V #16 = NameAndType #14:#8 // "<init>":()V #17 = Utf8 this #18 = Utf8 Ltest/jvmClass; #19 = Utf8 addI #20 = Utf8 (I)V #21 = Utf8 m #22 = Utf8 addI1 #23 = Utf8 (Ltest/order;)I #24 = Methodref #25.#27 // test/order.getPrice:()I #25 = Class #26 // test/order #26 = Utf8 test/order #27 = NameAndType #28:#29 // getPrice:()I #28 = Utf8 getPrice #29 = Utf8 ()I #30 = Utf8 o #31 = Utf8 Ltest/order; #32 = Utf8 StackMapTable #33 = Class #34 // java/lang/Throwable #34 = Utf8 java/lang/Throwable #35 = Utf8 minus #36 = Fieldref #37.#39 // java/lang/System.out:Ljava/io/PrintStream; #37 = Class #38 // java/lang/System #38 = Utf8 java/lang/System #39 = NameAndType #40:#41 // out:Ljava/io/PrintStream; #40 = Utf8 out #41 = Utf8 Ljava/io/PrintStream; #42 = String #43 // 出現異常 #43 = Utf8 出現異常 #44 = Methodref #45.#47 // java/io/PrintStream.println:(Ljava/lang/String;)V #45 = Class #46 // java/io/PrintStream #46 = Utf8 java/io/PrintStream #47 = NameAndType #48:#49 // println:(Ljava/lang/String;)V #48 = Utf8 println #49 = Utf8 (Ljava/lang/String;)V #50 = Methodref #51.#53 // java/lang/Exception.printStackTrace:()V #51 = Class #52 // java/lang/Exception #52 = Utf8 java/lang/Exception #53 = NameAndType #54:#8 // printStackTrace:()V #54 = Utf8 printStackTrace #55 = Utf8 n #56 = Utf8 e #57 = Utf8 Ljava/lang/Exception; #58 = Utf8 SourceFile #59 = Utf8 jvmClass.java { private static int i; descriptor: I flags: ACC_PRIVATE, ACC_STATIC static {}; descriptor: ()V flags: ACC_STATIC Code: stack=1, locals=0, args_size=0 0: iconst_0 1: putstatic #10 // Field i:I 4: return LineNumberTable: line 5: 0 LocalVariableTable: Start Length Slot Name Signature public test.jvmClass(); descriptor: ()V flags: ACC_PUBLIC Code: stack=1, locals=1, args_size=1 0: aload_0 1: invokespecial #15 // Method java/lang/Object."<init>":()V 4: return LineNumberTable: line 3: 0 LocalVariableTable: Start Length Slot Name Signature 0 5 0 this Ltest/jvmClass; public synchronized void addI(int); descriptor: (I)V flags: ACC_PUBLIC, ACC_SYNCHRONIZED Code: stack=2, locals=2, args_size=2 0: getstatic #10 // Field i:I 3: iload_1 4: iadd 5: putstatic #10 // Field i:I 8: return LineNumberTable: line 8: 0 line 9: 8 LocalVariableTable: Start Length Slot Name Signature 0 9 0 this Ltest/jvmClass; 0 9 1 m I public int addI1(test.order); descriptor: (Ltest/order;)I flags: ACC_PUBLIC Code: stack=2, locals=3, args_size=2 0: aload_0 1: dup 2: astore_2 3: monitorenter 4: getstatic #10 // Field i:I 7: aload_1 8: invokevirtual #24 // Method test/order.getPrice:()I 11: iadd 12: putstatic #10 // Field i:I 15: getstatic #10 // Field i:I 18: aload_2 19: monitorexit 20: ireturn 21: aload_2 22: monitorexit 23: athrow Exception table: from to target type 4 20 21 any 21 23 21 any LineNumberTable: line 11: 0 line 12: 4 line 13: 15 line 11: 21 LocalVariableTable: Start Length Slot Name Signature 0 24 0 this Ltest/jvmClass; 0 24 1 o Ltest/order; StackMapTable: number_of_entries = 1 frame_type = 255 /* full_frame */ offset_delta = 21 locals = [ class test/jvmClass, class test/order, class test/jvmClass ] stack = [ class java/lang/Throwable ] public void minus(int); descriptor: (I)V flags: ACC_PUBLIC Code: stack=2, locals=3, args_size=2 0: bipush 10 2: iload_1 3: idiv 4: istore_2 5: goto 21 8: astore_2 9: getstatic #36 // Field java/lang/System.out:Ljava/io/PrintStream; 12: ldc #42 // String 出現異常 14: invokevirtual #44 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 17: aload_2 18: invokevirtual #50 // Method java/lang/Exception.printStackTrace:()V 21: return Exception table: from to target type 0 5 8 Class java/lang/Exception LineNumberTable: line 19: 0 line 20: 5 line 22: 9 line 24: 17 line 26: 21 LocalVariableTable: Start Length Slot Name Signature 0 22 0 this Ltest/jvmClass; 0 22 1 n I 9 12 2 e Ljava/lang/Exception; StackMapTable: number_of_entries = 2 frame_type = 72 /* same_locals_1_stack_item */ stack = [ class java/lang/Exception ] frame_type = 12 /* same */ } SourceFile: "jvmClass.java"
這比直接在cmd命令行執行命令好多了server
好吧 更重要的是我得去看看字節碼格式了ip