blob: ecd7f41625df5815e2954d1bc345bd13b19defc3 [file] [log] [blame]
tbell16c34dd2009-05-04 18:28:26 -07001." Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
duke6e45e102007-12-01 00:00:00 +00002." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3."
4." This code is free software; you can redistribute it and/or modify it
5." under the terms of the GNU General Public License version 2 only, as
6." published by the Free Software Foundation.
7."
8." This code is distributed in the hope that it will be useful, but WITHOUT
9." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11." version 2 for more details (a copy is included in the LICENSE file that
12." accompanied this code).
13."
14." You should have received a copy of the GNU General Public License version
15." 2 along with this work; if not, write to the Free Software Foundation,
16." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17."
ohair2283b9d2010-05-25 15:58:33 -070018." 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
20." questions.
duke6e45e102007-12-01 00:00:00 +000021."
tbell16c34dd2009-05-04 18:28:26 -070022.TH javap 1 "04 May 2009"
23." Generated from HTML by html2man (author: Eric Armstrong)
duke6e45e102007-12-01 00:00:00 +000024
25.LP
tbell16c34dd2009-05-04 18:28:26 -070026.SH "Name"
duke6e45e102007-12-01 00:00:00 +000027javap \- The Java Class File Disassembler
28.LP
tbell16c34dd2009-05-04 18:28:26 -070029.RS 3
duke6e45e102007-12-01 00:00:00 +000030
31.LP
32.LP
33Disassembles class files.
34.LP
tbell16c34dd2009-05-04 18:28:26 -070035.RE
duke6e45e102007-12-01 00:00:00 +000036.SH "SYNOPSIS"
37.LP
38
39.LP
40.nf
41\f3
42.fl
43javap [ \fP\f3options\fP\f3 ] class. . .
44.fl
45\fP
46.fi
47
48.LP
49.SH "DESCRIPTION"
50.LP
51
52.LP
53.LP
54The \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:
55.LP
56.RS 3
57
58.LP
59.nf
60\f3
61.fl
62import java.awt.*;
63.fl
64import java.applet.*;
65.fl
66
67.fl
68public class DocFooter extends Applet {
69.fl
70 String date;
71.fl
72 String email;
73.fl
74
75.fl
76 public void init() {
77.fl
78 resize(500,100);
79.fl
80 date = getParameter("LAST_UPDATED");
81.fl
82 email = getParameter("EMAIL");
83.fl
84 }
85.fl
86
87.fl
88 public void paint(Graphics g) {
89.fl
90 g.drawString(date + " by ",100, 15);
91.fl
92 g.drawString(email,290,15);
93.fl
94 }
95.fl
96}
97.fl
98\fP
99.fi
100.RE
101
102.LP
103.LP
104The output from \f3javap DocFooter\fP yields:
105.LP
106.RS 3
107
108.LP
109.nf
110\f3
111.fl
112Compiled from DocFooter.java
113.fl
114public class DocFooter extends java.applet.Applet {
115.fl
116 java.lang.String date;
117.fl
118 java.lang.String email;
119.fl
120 public DocFooter();
121.fl
122 public void init();
123.fl
124 public void paint(java.awt.Graphics);
125.fl
126}
127.fl
128\fP
129.fi
130.RE
131
132.LP
133.LP
134The output from \f3javap \-c DocFooter\fP yields:
135.LP
136.RS 3
137
138.LP
139.nf
140\f3
141.fl
142Compiled from DocFooter.java
143.fl
144public class DocFooter extends java.applet.Applet {
145.fl
146 java.lang.String date;
147.fl
148 java.lang.String email;
149.fl
150 public DocFooter();
151.fl
152 public void init();
153.fl
154 public void paint(java.awt.Graphics);
155.fl
156}
157.fl
158
159.fl
160Method DocFooter()
161.fl
162 0 aload_0
163.fl
164 1 invokespecial #1 <Method java.applet.Applet()>
165.fl
166 4 return
167.fl
168
169.fl
170Method void init()
171.fl
172 0 aload_0
173.fl
174 1 sipush 500
175.fl
176 4 bipush 100
177.fl
178 6 invokevirtual #2 <Method void resize(int, int)>
179.fl
180 9 aload_0
181.fl
182 10 aload_0
183.fl
184 11 ldc #3 <String "LAST_UPDATED">
185.fl
186 13 invokevirtual #4 <Method java.lang.String getParameter(java.lang.String)>
187.fl
188 16 putfield #5 <Field java.lang.String date>
189.fl
190 19 aload_0
191.fl
192 20 aload_0
193.fl
194 21 ldc #6 <String "EMAIL">
195.fl
196 23 invokevirtual #4 <Method java.lang.String getParameter(java.lang.String)>
197.fl
198 26 putfield #7 <Field java.lang.String email>
199.fl
200 29 return
201.fl
202
203.fl
204Method void paint(java.awt.Graphics)
205.fl
206 0 aload_1
207.fl
208 1 new #8 <Class java.lang.StringBuffer>
209.fl
210 4 dup
211.fl
212 5 invokespecial #9 <Method java.lang.StringBuffer()>
213.fl
214 8 aload_0
215.fl
216 9 getfield #5 <Field java.lang.String date>
217.fl
218 12 invokevirtual #10 <Method java.lang.StringBuffer append(java.lang.String)>
219.fl
220 15 ldc #11 <String " by ">
221.fl
222 17 invokevirtual #10 <Method java.lang.StringBuffer append(java.lang.String)>
223.fl
224 20 invokevirtual #12 <Method java.lang.String toString()>
225.fl
226 23 bipush 100
227.fl
228 25 bipush 15
229.fl
230 27 invokevirtual #13 <Method void drawString(java.lang.String, int, int)>
231.fl
232 30 aload_1
233.fl
234 31 aload_0
235.fl
236 32 getfield #7 <Field java.lang.String email>
237.fl
238 35 sipush 290
239.fl
240 38 bipush 15
241.fl
242 40 invokevirtual #13 <Method void drawString(java.lang.String, int, int)>
243.fl
244 43 return
245.fl
246\fP
247.fi
248.RE
249
250.LP
251.SH "OPTIONS"
252.LP
253
254.LP
tbell16c34dd2009-05-04 18:28:26 -0700255.RS 3
duke6e45e102007-12-01 00:00:00 +0000256.TP 3
257\-help
258Prints out help message for \f3javap\fP.
259.TP 3
260\-l
261Prints out line and local variable tables.
262.TP 3
duke6e45e102007-12-01 00:00:00 +0000263\-public
264Shows only public classes and members.
265.TP 3
266\-protected
267Shows only protected and public classes and members.
268.TP 3
269\-package
270Shows only package, protected, and public classes and members. This is the default.
271.TP 3
272\-private
273Shows all classes and members.
274.TP 3
275\-Jflag
276Pass \f2flag\fP directly to the runtime system. Some examples:
277.RS 3
278
279.LP
280.nf
281\f3
282.fl
283javap \-J\-version
284.fl
285javap \-J\-Djava.security.manager \-J\-Djava.security.policy=MyPolicy MyClassName
286.fl
287\fP
288.fi
289.RE
290.TP 3
291\-s
292Prints internal type signatures.
293.TP 3
294\-c
295Prints 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
296.na
297\f2Java Virtual Machine Specification\fP @
298.fi
299http://java.sun.com/docs/books/vmspec/.
300.TP 3
301\-verbose
302Prints stack size, number of \f2locals\fP and \f2args\fP for methods.
303.TP 3
304\-classpath path
305Specifies 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:
306.nf
307\f3
308.fl
309 .:<your_path>
310.fl
311\fP
312.fi
313For example:
314.nf
315\f3
316.fl
317.:/home/avh/classes:/usr/local/java/classes
318.fl
319\fP
320.fi
321.TP 3
322\-bootclasspath path
323Specifies 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.
324.TP 3
325\-extdirs dirs
326Overrides location at which installed extensions are searched for. The default location for extensions is the value of \f2java.ext.dirs\fP.
tbell16c34dd2009-05-04 18:28:26 -0700327.RE
328
duke6e45e102007-12-01 00:00:00 +0000329.LP
330.SH "ENVIRONMENT VARIABLES"
331.LP
332
333.LP
tbell16c34dd2009-05-04 18:28:26 -0700334.RS 3
duke6e45e102007-12-01 00:00:00 +0000335.TP 3
336CLASSPATH
337Used to provide the system a path to user\-defined classes. Directories are separated by colons, for example, For example:
338.RS 3
339
340.LP
341.nf
342\f3
343.fl
344.:/home/avh/classes:/usr/local/java/classes
345.fl
346\fP
347.fi
348.RE
tbell16c34dd2009-05-04 18:28:26 -0700349.RE
duke6e45e102007-12-01 00:00:00 +0000350
351.LP
352.SH "SEE ALSO"
353.LP
354
355.LP
356.LP
tbell16c34dd2009-05-04 18:28:26 -0700357javac(1), java(1), jdb(1), javah(1), javadoc(1)
duke6e45e102007-12-01 00:00:00 +0000358.LP
359
360.LP
361