最后来看个jd-gui没有一个功能
查看生成.class的jdk版本。
这个信息在解决.class文件和jdk版本不一致时很有用
命令:
javap -v chapter5/ClassForDecompile
Output:
Classfile /E:/java/JavaStudy/src/chapter5/ClassForDecompile.class
Last modified 2016-4-3; size 416 bytes
MD5 checksum accb0a72def6c8da33e5da929bee6dcc
Compiled from "ClassForDecompile.java"
public class chapter5.ClassForDecompile
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #7.#16 // java/lang/Object."":()V
#2 = Class #17 // chapter5/Student
#3 = String #18 // Tom
#4 = Methodref #2.#19 // chapter5/Student."":(Ljava/la
ng/String;I)V
#5 = Methodref #20.#21 // chapter5/Person.work:()V
#6 = Class #22 // chapter5/ClassForDecompile
#7 = Class #23 // java/lang/Object
#8 = Utf8
#9 = Utf8 ()V
#10 = Utf8 Code
#11 = Utf8 LineNumberTable
#12 = Utf8 main
#13 = Utf8 ([Ljava/lang/String;)V
#14 = Utf8 SourceFile
#15 = Utf8 ClassForDecompile.java
#16 = NameAndType #8:#9 // "":()V
#17 = Utf8 chapter5/Student
#18 = Utf8 Tom
#19 = NameAndType #8:#24 // "":(Ljava/lang/String;I)V
#20 = Class #25 // chapter5/Person
#21 = NameAndType #26:#9 // work:()V
#22 = Utf8 chapter5/ClassForDecompile
#23 = Utf8 java/lang/Object
#24 = Utf8 (Ljava/lang/String;I)V
#25 = Utf8 chapter5/Person
#26 = Utf8 work
{
public chapter5.ClassForDecompile();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."
":()V
4: return
LineNumberTable:
line 6: 0
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=2, args_size=1
0: new #2 // class chapter5/Student
3: dup
4: ldc #3 // String Tom
6: bipush 15
8: invokespecial #4 // Method chapter5/Student."
":(Ljava/lang/String;I)V
11: astore_1
12: aload_1
13: invokevirtual #5 // Method chapter5/Person.work:()V
16: return
LineNumberTable:
line 8: 0
line 9: 12
line 10: 16
}
SourceFile: "ClassForDecompile.java"