1javap(1) Basic Tools javap(1)
2
3
4
6 javap - Disassembles one or more class files.
7
9 javap [options] classfile...
10
11 options
12 The command-line options. See Options.
13
14 classfile
15 One or more classes separated by spaces to be processed for
16 annotations such as DocFooter.class. You can specify a class that
17 can be found in the class path, by its file name or with a URL such
18 as file:///home/user/myproject/src/DocFooter.class.
19
21 The javap command disassembles one or more class files. The output
22 depends on the options used. When no options are used, then the javap
23 command prints the package, protected and public fields, and methods of
24 the classes passed to it. The javap command prints its output to
25 stdout.
26
28 -help
29 --help
30 -?
31 Prints a help message for the javap command.
32
33 -version
34 Prints release information.
35
36 -l
37 Prints line and local variable tables.
38
39 -public
40 Shows only public classes and members.
41
42 -protected
43 Shows only protected and public classes and members.
44
45 -private
46 -p
47 Shows all classes and members.
48
49 -Joption
50 Passes the specified option to the JVM. For example:
51
52 javap -J-version
53 javap -J-Djava.security.manager -J-Djava.security.policy=MyPolicy MyClassName
54
55 For more information about JVM options, see the command
56 documentation.
57
58 -s
59 Prints internal type signatures.
60
61 -sysinfo
62 Shows system information (path, size, date, MD5 hash) of the class
63 being processed.
64
65 -constants
66 Shows static final constants.
67
68 -c
69 Prints disassembled code, for example, the instructions that
70 comprise the Java bytecodes, for each of the methods in the class.
71
72 -verbose
73 Prints stack size, number of locals and arguments for methods.
74
75 -classpath path
76 Specifies the path the javap command uses to look up classes.
77 Overrides the default or the CLASSPATH environment variable when it
78 is set.
79
80 -bootclasspath path
81 Specifies the path from which to load bootstrap classes. By
82 default, the bootstrap classes are the classes that implement the
83 core Java platform located in jre/lib/rt.jar and several other JAR
84 files.
85
86 -extdir dirs
87 Overrides the location at which installed extensions are searched
88 for. The default location for extensions is the value of
89 java.ext.dirs.
90
92 Compile the following DocFooter class:
93
94 import java.awt.*;
95 import java.applet.*;
96
97 public class DocFooter extends Applet {
98 String date;
99 String email;
100
101 public void init() {
102 resize(500,100);
103 date = getParameter("LAST_UPDATED");
104 email = getParameter("EMAIL");
105 }
106
107 public void paint(Graphics g) {
108 g.drawString(date + " by ",100, 15);
109 g.drawString(email,290,15);
110 }
111 }
112
113
114 The output from the javap DocFooter.class command yields the following:
115
116 Compiled from "DocFooter.java"
117 public class DocFooter extends java.applet.Applet {
118 java.lang.String date;
119 java.lang.String email;
120 public DocFooter();
121 public void init();
122 public void paint(java.awt.Graphics);
123 }
124
125
126 The output from javap -c DocFooter.class command yields the following:
127
128 Compiled from "DocFooter.java"
129 public class DocFooter extends java.applet.Applet {
130 java.lang.String date;
131 java.lang.String email;
132
133 public DocFooter();
134 Code:
135 0: aload_0
136 1: invokespecial #1 // Method
137 java/applet/Applet."<init>":()V
138 4: return
139
140 public void init();
141 Code:
142 0: aload_0
143 1: sipush 500
144 4: bipush 100
145 6: invokevirtual #2 // Method resize:(II)V
146 9: aload_0
147 10: aload_0
148 11: ldc #3 // String LAST_UPDATED
149 13: invokevirtual #4 // Method
150 getParameter:(Ljava/lang/String;)Ljava/lang/String;
151 16: putfield #5 // Field date:Ljava/lang/String;
152 19: aload_0
153 20: aload_0
154 21: ldc #6 // String EMAIL
155 23: invokevirtual #4 // Method
156 getParameter:(Ljava/lang/String;)Ljava/lang/String;
157 26: putfield #7 // Field email:Ljava/lang/String;
158 29: return
159
160 public void paint(java.awt.Graphics);
161 Code:
162 0: aload_1
163 1: new #8 // class java/lang/StringBuilder
164 4: dup
165 5: invokespecial #9 // Method
166 java/lang/StringBuilder."<init>":()V
167 8: aload_0
168 9: getfield #5 // Field date:Ljava/lang/String;
169 12: invokevirtual #10 // Method
170 java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
171 15: ldc #11 // String by
172 17: invokevirtual #10 // Method
173 java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
174 20: invokevirtual #12 // Method
175 java/lang/StringBuilder.toString:()Ljava/lang/String;
176 23: bipush 100
177 25: bipush 15
178 27: invokevirtual #13 // Method
179 java/awt/Graphics.drawString:(Ljava/lang/String;II)V
180 30: aload_1
181 31: aload_0
182 32: getfield #7 // Field email:Ljava/lang/String;
183 35: sipush 290
184 38: bipush 15
185 40: invokevirtual #13 // Method
186 java/awt/Graphics.drawString:(Ljava/lang/String;II)V
187 43: return
188 }
189
190
192 · java(1)
193
194 · javac(1)
195
196 · javadoc(1)
197
198 · jdb(1)
199
200 · jdeps(1)
201
202
203
204JDK 8 8 August 2014 javap(1)