17 ." |
17 ." |
18 ." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
18 ." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 ." or visit www.oracle.com if you need additional information or have any |
19 ." or visit www.oracle.com if you need additional information or have any |
20 ." questions. |
20 ." questions. |
21 ." |
21 ." |
22 .TH javap 1 "02 Jun 2010" |
22 .TH javap 1 "10 May 2011" |
23 |
23 |
24 .LP |
24 .LP |
25 .SH "Name" |
25 .SH "Name" |
26 javap \- The Java Class File Disassembler |
26 javap \- The Java Class File Disassembler |
27 .LP |
27 .LP |
|
28 .LP |
|
29 Disassembles class files. |
|
30 .LP |
|
31 .SH "SYNOPSIS" |
|
32 .LP |
|
33 .nf |
|
34 \f3 |
|
35 .fl |
|
36 javap [ \fP\f3options\fP\f3 ] classes |
|
37 .fl |
|
38 \fP |
|
39 .fi |
|
40 |
|
41 .LP |
|
42 .SH "DESCRIPTION" |
|
43 .LP |
|
44 .LP |
|
45 The \f3javap\fP command disassembles one or more class files. Its output depends on the options used. If no options are used, \f3javap\fP prints out the package, protected, and public fields and methods of the classes passed to it. \f3javap\fP prints its output to stdout. |
|
46 .LP |
28 .RS 3 |
47 .RS 3 |
29 |
48 .TP 3 |
30 .LP |
49 options |
31 .LP |
50 Command\-line options. |
32 Disassembles class files. |
51 .TP 3 |
33 .LP |
52 classes |
|
53 List of one or more classes (separated by spaces) to be processed for annotations (such as \f2DocFooter.class\fP). You may specify a class that can be found in the class path, by its file name (for example, \f2/home/user/myproject/src/DocFooter.class\fP), or with a URL (for example, \f2file:///home/user/myproject/src/DocFooter.class\fP). |
34 .RE |
54 .RE |
35 .SH "SYNOPSIS" |
55 |
36 .LP |
56 .LP |
37 |
57 .LP |
38 .LP |
58 For example, compile the following class declaration: |
39 .nf |
59 .LP |
40 \f3 |
60 .nf |
41 .fl |
61 \f3 |
42 javap [ \fP\f3options\fP\f3 ] class. . . |
62 .fl |
43 .fl |
63 import java.awt.*; |
44 \fP |
64 .fl |
45 .fi |
65 import java.applet.*; |
46 |
66 .fl |
47 .LP |
67 |
48 .SH "DESCRIPTION" |
68 .fl |
49 .LP |
69 public class DocFooter extends Applet { |
50 |
70 .fl |
51 .LP |
71 String date; |
52 .LP |
72 .fl |
53 The \f3javap\fP command disassembles a class file. Its output depends on the options used. If no options are used, \f3javap\fP prints out the package, protected, and public fields and methods of the classes passed to it. \f3javap\fP prints its output to stdout. For example, compile the following class declaration: |
73 String email; |
|
74 .fl |
|
75 |
|
76 .fl |
|
77 public void init() { |
|
78 .fl |
|
79 resize(500,100); |
|
80 .fl |
|
81 date = getParameter("LAST_UPDATED"); |
|
82 .fl |
|
83 email = getParameter("EMAIL"); |
|
84 .fl |
|
85 } |
|
86 .fl |
|
87 |
|
88 .fl |
|
89 public void paint(Graphics g) { |
|
90 .fl |
|
91 g.drawString(date + " by ",100, 15); |
|
92 .fl |
|
93 g.drawString(email,290,15); |
|
94 .fl |
|
95 } |
|
96 .fl |
|
97 } |
|
98 .fl |
|
99 \fP |
|
100 .fi |
|
101 |
|
102 .LP |
|
103 .LP |
|
104 The output from \f3javap DocFooter.class\fP yields: |
|
105 .LP |
|
106 .nf |
|
107 \f3 |
|
108 .fl |
|
109 Compiled from "DocFooter.java" |
|
110 .fl |
|
111 public class DocFooter extends java.applet.Applet { |
|
112 .fl |
|
113 java.lang.String date; |
|
114 .fl |
|
115 java.lang.String email; |
|
116 .fl |
|
117 public DocFooter(); |
|
118 .fl |
|
119 public void init(); |
|
120 .fl |
|
121 public void paint(java.awt.Graphics); |
|
122 .fl |
|
123 } |
|
124 .fl |
|
125 \fP |
|
126 .fi |
|
127 |
|
128 .LP |
|
129 .LP |
|
130 The output from \f3javap \-c DocFooter.class\fP yields: |
|
131 .LP |
|
132 .nf |
|
133 \f3 |
|
134 .fl |
|
135 Compiled from "DocFooter.java" |
|
136 .fl |
|
137 public class DocFooter extends java.applet.Applet { |
|
138 .fl |
|
139 java.lang.String date; |
|
140 .fl |
|
141 |
|
142 .fl |
|
143 java.lang.String email; |
|
144 .fl |
|
145 |
|
146 .fl |
|
147 public DocFooter(); |
|
148 .fl |
|
149 Code: |
|
150 .fl |
|
151 0: aload_0 |
|
152 .fl |
|
153 1: invokespecial #1 // Method java/applet/Applet."<init>":()V |
|
154 .fl |
|
155 4: return |
|
156 .fl |
|
157 |
|
158 .fl |
|
159 public void init(); |
|
160 .fl |
|
161 Code: |
|
162 .fl |
|
163 0: aload_0 |
|
164 .fl |
|
165 1: sipush 500 |
|
166 .fl |
|
167 4: bipush 100 |
|
168 .fl |
|
169 6: invokevirtual #2 // Method resize:(II)V |
|
170 .fl |
|
171 9: aload_0 |
|
172 .fl |
|
173 10: aload_0 |
|
174 .fl |
|
175 11: ldc #3 // String LAST_UPDATED |
|
176 .fl |
|
177 13: invokevirtual #4 // Method getParameter:(Ljava/lang/String;)Ljava/lang/String; |
|
178 .fl |
|
179 16: putfield #5 // Field date:Ljava/lang/String; |
|
180 .fl |
|
181 19: aload_0 |
|
182 .fl |
|
183 20: aload_0 |
|
184 .fl |
|
185 21: ldc #6 // String EMAIL |
|
186 .fl |
|
187 23: invokevirtual #4 // Method getParameter:(Ljava/lang/String;)Ljava/lang/String; |
|
188 .fl |
|
189 26: putfield #7 // Field email:Ljava/lang/String; |
|
190 .fl |
|
191 29: return |
|
192 .fl |
|
193 |
|
194 .fl |
|
195 public void paint(java.awt.Graphics); |
|
196 .fl |
|
197 Code: |
|
198 .fl |
|
199 0: aload_1 |
|
200 .fl |
|
201 1: new #8 // class java/lang/StringBuilder |
|
202 .fl |
|
203 4: dup |
|
204 .fl |
|
205 5: invokespecial #9 // Method java/lang/StringBuilder."<init>":()V |
|
206 .fl |
|
207 8: aload_0 |
|
208 .fl |
|
209 9: getfield #5 // Field date:Ljava/lang/String; |
|
210 .fl |
|
211 12: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
212 .fl |
|
213 15: ldc #11 // String by |
|
214 .fl |
|
215 17: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
216 .fl |
|
217 20: invokevirtual #12 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; |
|
218 .fl |
|
219 23: bipush 100 |
|
220 .fl |
|
221 25: bipush 15 |
|
222 .fl |
|
223 27: invokevirtual #13 // Method java/awt/Graphics.drawString:(Ljava/lang/String;II)V |
|
224 .fl |
|
225 30: aload_1 |
|
226 .fl |
|
227 31: aload_0 |
|
228 .fl |
|
229 32: getfield #7 // Field email:Ljava/lang/String; |
|
230 .fl |
|
231 35: sipush 290 |
|
232 .fl |
|
233 38: bipush 15 |
|
234 .fl |
|
235 40: invokevirtual #13 // Method java/awt/Graphics.drawString:(Ljava/lang/String;II)V |
|
236 .fl |
|
237 43: return |
|
238 .fl |
|
239 } |
|
240 .fl |
|
241 \fP |
|
242 .fi |
|
243 |
|
244 .LP |
|
245 .SH "OPTIONS" |
54 .LP |
246 .LP |
55 .RS 3 |
247 .RS 3 |
56 |
248 .TP 3 |
57 .LP |
249 \-help \-\-help \-? |
58 .nf |
|
59 \f3 |
|
60 .fl |
|
61 import java.awt.*; |
|
62 .fl |
|
63 import java.applet.*; |
|
64 .fl |
|
65 |
|
66 .fl |
|
67 public class DocFooter extends Applet { |
|
68 .fl |
|
69 String date; |
|
70 .fl |
|
71 String email; |
|
72 .fl |
|
73 |
|
74 .fl |
|
75 public void init() { |
|
76 .fl |
|
77 resize(500,100); |
|
78 .fl |
|
79 date = getParameter("LAST_UPDATED"); |
|
80 .fl |
|
81 email = getParameter("EMAIL"); |
|
82 .fl |
|
83 } |
|
84 .fl |
|
85 |
|
86 .fl |
|
87 public void paint(Graphics g) { |
|
88 .fl |
|
89 g.drawString(date + " by ",100, 15); |
|
90 .fl |
|
91 g.drawString(email,290,15); |
|
92 .fl |
|
93 } |
|
94 .fl |
|
95 } |
|
96 .fl |
|
97 \fP |
|
98 .fi |
|
99 .RE |
|
100 |
|
101 .LP |
|
102 .LP |
|
103 The output from \f3javap DocFooter\fP yields: |
|
104 .LP |
|
105 .RS 3 |
|
106 |
|
107 .LP |
|
108 .nf |
|
109 \f3 |
|
110 .fl |
|
111 Compiled from DocFooter.java |
|
112 .fl |
|
113 public class DocFooter extends java.applet.Applet { |
|
114 .fl |
|
115 java.lang.String date; |
|
116 .fl |
|
117 java.lang.String email; |
|
118 .fl |
|
119 public DocFooter(); |
|
120 .fl |
|
121 public void init(); |
|
122 .fl |
|
123 public void paint(java.awt.Graphics); |
|
124 .fl |
|
125 } |
|
126 .fl |
|
127 \fP |
|
128 .fi |
|
129 .RE |
|
130 |
|
131 .LP |
|
132 .LP |
|
133 The output from \f3javap \-c DocFooter\fP yields: |
|
134 .LP |
|
135 .RS 3 |
|
136 |
|
137 .LP |
|
138 .nf |
|
139 \f3 |
|
140 .fl |
|
141 Compiled from DocFooter.java |
|
142 .fl |
|
143 public class DocFooter extends java.applet.Applet { |
|
144 .fl |
|
145 java.lang.String date; |
|
146 .fl |
|
147 java.lang.String email; |
|
148 .fl |
|
149 public DocFooter(); |
|
150 .fl |
|
151 public void init(); |
|
152 .fl |
|
153 public void paint(java.awt.Graphics); |
|
154 .fl |
|
155 } |
|
156 .fl |
|
157 |
|
158 .fl |
|
159 Method DocFooter() |
|
160 .fl |
|
161 0 aload_0 |
|
162 .fl |
|
163 1 invokespecial #1 <Method java.applet.Applet()> |
|
164 .fl |
|
165 4 return |
|
166 .fl |
|
167 |
|
168 .fl |
|
169 Method void init() |
|
170 .fl |
|
171 0 aload_0 |
|
172 .fl |
|
173 1 sipush 500 |
|
174 .fl |
|
175 4 bipush 100 |
|
176 .fl |
|
177 6 invokevirtual #2 <Method void resize(int, int)> |
|
178 .fl |
|
179 9 aload_0 |
|
180 .fl |
|
181 10 aload_0 |
|
182 .fl |
|
183 11 ldc #3 <String "LAST_UPDATED"> |
|
184 .fl |
|
185 13 invokevirtual #4 <Method java.lang.String getParameter(java.lang.String)> |
|
186 .fl |
|
187 16 putfield #5 <Field java.lang.String date> |
|
188 .fl |
|
189 19 aload_0 |
|
190 .fl |
|
191 20 aload_0 |
|
192 .fl |
|
193 21 ldc #6 <String "EMAIL"> |
|
194 .fl |
|
195 23 invokevirtual #4 <Method java.lang.String getParameter(java.lang.String)> |
|
196 .fl |
|
197 26 putfield #7 <Field java.lang.String email> |
|
198 .fl |
|
199 29 return |
|
200 .fl |
|
201 |
|
202 .fl |
|
203 Method void paint(java.awt.Graphics) |
|
204 .fl |
|
205 0 aload_1 |
|
206 .fl |
|
207 1 new #8 <Class java.lang.StringBuffer> |
|
208 .fl |
|
209 4 dup |
|
210 .fl |
|
211 5 invokespecial #9 <Method java.lang.StringBuffer()> |
|
212 .fl |
|
213 8 aload_0 |
|
214 .fl |
|
215 9 getfield #5 <Field java.lang.String date> |
|
216 .fl |
|
217 12 invokevirtual #10 <Method java.lang.StringBuffer append(java.lang.String)> |
|
218 .fl |
|
219 15 ldc #11 <String " by "> |
|
220 .fl |
|
221 17 invokevirtual #10 <Method java.lang.StringBuffer append(java.lang.String)> |
|
222 .fl |
|
223 20 invokevirtual #12 <Method java.lang.String toString()> |
|
224 .fl |
|
225 23 bipush 100 |
|
226 .fl |
|
227 25 bipush 15 |
|
228 .fl |
|
229 27 invokevirtual #13 <Method void drawString(java.lang.String, int, int)> |
|
230 .fl |
|
231 30 aload_1 |
|
232 .fl |
|
233 31 aload_0 |
|
234 .fl |
|
235 32 getfield #7 <Field java.lang.String email> |
|
236 .fl |
|
237 35 sipush 290 |
|
238 .fl |
|
239 38 bipush 15 |
|
240 .fl |
|
241 40 invokevirtual #13 <Method void drawString(java.lang.String, int, int)> |
|
242 .fl |
|
243 43 return |
|
244 .fl |
|
245 \fP |
|
246 .fi |
|
247 .RE |
|
248 |
|
249 .LP |
|
250 .SH "OPTIONS" |
|
251 .LP |
|
252 |
|
253 .LP |
|
254 .RS 3 |
|
255 .TP 3 |
|
256 \-help |
|
257 Prints out help message for \f3javap\fP. |
250 Prints out help message for \f3javap\fP. |
|
251 .TP 3 |
|
252 \-version |
|
253 Prints out version information. |
258 .TP 3 |
254 .TP 3 |
259 \-l |
255 \-l |
260 Prints out line and local variable tables. |
256 Prints out line and local variable tables. |
261 .TP 3 |
257 .TP 3 |
262 \-public |
258 \-public |
266 Shows only protected and public classes and members. |
262 Shows only protected and public classes and members. |
267 .TP 3 |
263 .TP 3 |
268 \-package |
264 \-package |
269 Shows only package, protected, and public classes and members. This is the default. |
265 Shows only package, protected, and public classes and members. This is the default. |
270 .TP 3 |
266 .TP 3 |
271 \-private |
267 \-private \-p |
272 Shows all classes and members. |
268 Shows all classes and members. |
273 .TP 3 |
269 .TP 3 |
274 \-Jflag |
270 \-Jflag |
275 Pass \f2flag\fP directly to the runtime system. Some examples: |
271 Pass \f2flag\fP directly to the runtime system. Some examples: |
276 .RS 3 |
|
277 |
|
278 .LP |
|
279 .nf |
272 .nf |
280 \f3 |
273 \f3 |
281 .fl |
274 .fl |
282 javap \-J\-version |
275 javap \-J\-version |
283 .fl |
276 .fl |
284 javap \-J\-Djava.security.manager \-J\-Djava.security.policy=MyPolicy MyClassName |
277 javap \-J\-Djava.security.manager \-J\-Djava.security.policy=MyPolicy MyClassName |
285 .fl |
278 .fl |
286 \fP |
279 \fP |
287 .fi |
280 .fi |
288 .RE |
|
289 .TP 3 |
281 .TP 3 |
290 \-s |
282 \-s |
291 Prints internal type signatures. |
283 Prints internal type signatures. |
|
284 .TP 3 |
|
285 \-sysinfo |
|
286 Shows system information (path, size, date, MD5 hash) of the class being processed. |
|
287 .TP 3 |
|
288 \-constants |
|
289 Shows static final constants. |
292 .TP 3 |
290 .TP 3 |
293 \-c |
291 \-c |
294 Prints out disassembled code, i.e., the instructions that comprise the Java bytecodes, for each of the methods in the class. These are documented in the |
292 Prints out disassembled code, i.e., the instructions that comprise the Java bytecodes, for each of the methods in the class. These are documented in the |
295 .na |
293 .na |
296 \f2Java Virtual Machine Specification\fP @ |
294 \f2Java Virtual Machine Specification\fP @ |
299 .TP 3 |
297 .TP 3 |
300 \-verbose |
298 \-verbose |
301 Prints stack size, number of \f2locals\fP and \f2args\fP for methods. |
299 Prints stack size, number of \f2locals\fP and \f2args\fP for methods. |
302 .TP 3 |
300 .TP 3 |
303 \-classpath path |
301 \-classpath path |
304 Specifies the path \f3javap\fP uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set. Directories are separated by colons. Thus the general format for \f2path\fP is: |
302 Specifies the path \f3javap\fP uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set. |
305 .nf |
|
306 \f3 |
|
307 .fl |
|
308 .:<your_path> |
|
309 .fl |
|
310 \fP |
|
311 .fi |
|
312 For example: |
|
313 .nf |
|
314 \f3 |
|
315 .fl |
|
316 .:/home/avh/classes:/usr/local/java/classes |
|
317 .fl |
|
318 \fP |
|
319 .fi |
|
320 .TP 3 |
303 .TP 3 |
321 \-bootclasspath path |
304 \-bootclasspath path |
322 Specifies path from which to load bootstrap classes. By default, the bootstrap classes are the classes implementing the core Java platform located in \f2jre/lib/rt.jar\fP and several other jar files. |
305 Specifies path from which to load bootstrap classes. By default, the bootstrap classes are the classes implementing the core Java platform located in \f2jre/lib/rt.jar\fP and several other jar files. |
323 .TP 3 |
306 .TP 3 |
324 \-extdirs dirs |
307 \-extdirs dirs |
325 Overrides location at which installed extensions are searched for. The default location for extensions is the value of \f2java.ext.dirs\fP. |
308 Overrides location at which installed extensions are searched for. The default location for extensions is the value of \f2java.ext.dirs\fP. |
326 .RE |
309 .RE |
327 |
310 |
328 .LP |
311 .LP |
329 .SH "ENVIRONMENT VARIABLES" |
|
330 .LP |
|
331 |
|
332 .LP |
|
333 .RS 3 |
|
334 .TP 3 |
|
335 CLASSPATH |
|
336 Used to provide the system a path to user\-defined classes. Directories are separated by colons, for example, For example: |
|
337 .RS 3 |
|
338 |
|
339 .LP |
|
340 .nf |
|
341 \f3 |
|
342 .fl |
|
343 .:/home/avh/classes:/usr/local/java/classes |
|
344 .fl |
|
345 \fP |
|
346 .fi |
|
347 .RE |
|
348 .RE |
|
349 |
|
350 .LP |
|
351 .SH "SEE ALSO" |
312 .SH "SEE ALSO" |
352 .LP |
313 .LP |
353 |
|
354 .LP |
|
355 .LP |
314 .LP |
356 javac(1), java(1), jdb(1), javah(1), javadoc(1) |
315 javac(1), java(1), jdb(1), javah(1), javadoc(1) |
357 .LP |
316 .LP |
358 |
317 |