blob: 795be8a83de3ce0c133fe7248888e62d106e86c1 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001.'" t
2."
3." Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
4." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5."
6." This code is free software; you can redistribute it and/or modify it
7." under the terms of the GNU General Public License version 2 only, as
8." published by the Free Software Foundation.
9."
10." This code is distributed in the hope that it will be useful, but WITHOUT
11." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13." version 2 for more details (a copy is included in the LICENSE file that
14." accompanied this code).
15."
16." You should have received a copy of the GNU General Public License version
17." 2 along with this work; if not, write to the Free Software Foundation,
18." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19."
20." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21." CA 95054 USA or visit www.sun.com if you need additional information or
22." have any questions.
23."
24." `
25.TH javap 1 "05 Aug 2006"
26." Generated by html2roff
27
28.LP
29.SH NAME
30javap \- The Java Class File Disassembler
31.LP
32
33.LP
34.LP
35Disassembles class files.
36.LP
37.SH "SYNOPSIS"
38.LP
39
40.LP
41.nf
42\f3
43.fl
44javap [ \fP\f3options\fP\f3 ] class. . .
45.fl
46\fP
47.fi
48
49.LP
50.SH "DESCRIPTION"
51.LP
52
53.LP
54.LP
55The \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:
56.LP
57.RS 3
58
59.LP
60.nf
61\f3
62.fl
63import java.awt.*;
64.fl
65import java.applet.*;
66.fl
67
68.fl
69public class DocFooter extends Applet {
70.fl
71 String date;
72.fl
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.RE
102
103.LP
104.LP
105The output from \f3javap DocFooter\fP yields:
106.LP
107.RS 3
108
109.LP
110.nf
111\f3
112.fl
113Compiled from DocFooter.java
114.fl
115public class DocFooter extends java.applet.Applet {
116.fl
117 java.lang.String date;
118.fl
119 java.lang.String email;
120.fl
121 public DocFooter();
122.fl
123 public void init();
124.fl
125 public void paint(java.awt.Graphics);
126.fl
127}
128.fl
129\fP
130.fi
131.RE
132
133.LP
134.LP
135The output from \f3javap \-c DocFooter\fP yields:
136.LP
137.RS 3
138
139.LP
140.nf
141\f3
142.fl
143Compiled from DocFooter.java
144.fl
145public class DocFooter extends java.applet.Applet {
146.fl
147 java.lang.String date;
148.fl
149 java.lang.String email;
150.fl
151 public DocFooter();
152.fl
153 public void init();
154.fl
155 public void paint(java.awt.Graphics);
156.fl
157}
158.fl
159
160.fl
161Method DocFooter()
162.fl
163 0 aload_0
164.fl
165 1 invokespecial #1 <Method java.applet.Applet()>
166.fl
167 4 return
168.fl
169
170.fl
171Method void init()
172.fl
173 0 aload_0
174.fl
175 1 sipush 500
176.fl
177 4 bipush 100
178.fl
179 6 invokevirtual #2 <Method void resize(int, int)>
180.fl
181 9 aload_0
182.fl
183 10 aload_0
184.fl
185 11 ldc #3 <String "LAST_UPDATED">
186.fl
187 13 invokevirtual #4 <Method java.lang.String getParameter(java.lang.String)>
188.fl
189 16 putfield #5 <Field java.lang.String date>
190.fl
191 19 aload_0
192.fl
193 20 aload_0
194.fl
195 21 ldc #6 <String "EMAIL">
196.fl
197 23 invokevirtual #4 <Method java.lang.String getParameter(java.lang.String)>
198.fl
199 26 putfield #7 <Field java.lang.String email>
200.fl
201 29 return
202.fl
203
204.fl
205Method void paint(java.awt.Graphics)
206.fl
207 0 aload_1
208.fl
209 1 new #8 <Class java.lang.StringBuffer>
210.fl
211 4 dup
212.fl
213 5 invokespecial #9 <Method java.lang.StringBuffer()>
214.fl
215 8 aload_0
216.fl
217 9 getfield #5 <Field java.lang.String date>
218.fl
219 12 invokevirtual #10 <Method java.lang.StringBuffer append(java.lang.String)>
220.fl
221 15 ldc #11 <String " by ">
222.fl
223 17 invokevirtual #10 <Method java.lang.StringBuffer append(java.lang.String)>
224.fl
225 20 invokevirtual #12 <Method java.lang.String toString()>
226.fl
227 23 bipush 100
228.fl
229 25 bipush 15
230.fl
231 27 invokevirtual #13 <Method void drawString(java.lang.String, int, int)>
232.fl
233 30 aload_1
234.fl
235 31 aload_0
236.fl
237 32 getfield #7 <Field java.lang.String email>
238.fl
239 35 sipush 290
240.fl
241 38 bipush 15
242.fl
243 40 invokevirtual #13 <Method void drawString(java.lang.String, int, int)>
244.fl
245 43 return
246.fl
247\fP
248.fi
249.RE
250
251.LP
252.SH "OPTIONS"
253.LP
254
255.LP
256.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
263\-b
264Ensures backward compatibility with \f3javap\fP in JDK 1.1.
265.TP 3
266\-public
267Shows only public classes and members.
268.TP 3
269\-protected
270Shows only protected and public classes and members.
271.TP 3
272\-package
273Shows only package, protected, and public classes and members. This is the default.
274.TP 3
275\-private
276Shows all classes and members.
277.TP 3
278\-Jflag
279Pass \f2flag\fP directly to the runtime system. Some examples:
280.RS 3
281
282.LP
283.nf
284\f3
285.fl
286javap \-J\-version
287.fl
288javap \-J\-Djava.security.manager \-J\-Djava.security.policy=MyPolicy MyClassName
289.fl
290\fP
291.fi
292.RE
293.TP 3
294\-s
295Prints internal type signatures.
296.TP 3
297\-c
298Prints 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
299.na
300\f2Java Virtual Machine Specification\fP @
301.fi
302http://java.sun.com/docs/books/vmspec/.
303.TP 3
304\-verbose
305Prints stack size, number of \f2locals\fP and \f2args\fP for methods.
306.TP 3
307\-classpath path
308Specifies 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:
309.nf
310\f3
311.fl
312 .:<your_path>
313.fl
314\fP
315.fi
316For example:
317.nf
318\f3
319.fl
320.:/home/avh/classes:/usr/local/java/classes
321.fl
322\fP
323.fi
324.TP 3
325\-bootclasspath path
326Specifies 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.
327.TP 3
328\-extdirs dirs
329Overrides location at which installed extensions are searched for. The default location for extensions is the value of \f2java.ext.dirs\fP.
330.LP
331.SH "ENVIRONMENT VARIABLES"
332.LP
333
334.LP
335.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
349
350.LP
351.SH "SEE ALSO"
352.LP
353
354.LP
355.LP
356javac, java, jdb, javah, javadoc
357.LP
358
359.LP
360