blob: aeca79c35db624d4ef2c248fcf9af7cdf7874609 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001.'" t
2." Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
3." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4."
5." This code is free software; you can redistribute it and/or modify it
6." under the terms of the GNU General Public License version 2 only, as
7." published by the Free Software Foundation.
8."
9." This code is distributed in the hope that it will be useful, but WITHOUT
10." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12." version 2 for more details (a copy is included in the LICENSE file that
13." accompanied this code).
14."
15." You should have received a copy of the GNU General Public License version
16." 2 along with this work; if not, write to the Free Software Foundation,
17." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18."
19." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20." CA 95054 USA or visit www.sun.com if you need additional information or
21." have any questions.
22." `
23.TH javap 1 "05 Aug 2006"
24." Generated by html2roff
25
26.LP
27.SH NAME
28javap \- The Java Class File Disassembler
29.LP
30
31.LP
32.LP
33Disassembles class files.
34.LP
35.SH "SYNOPSIS"
36.LP
37
38.LP
39.nf
40\f3
41.fl
42javap [ \fP\f3options\fP\f3 ] class. . .
43.fl
44\fP
45.fi
46
47.LP
48.SH "DESCRIPTION"
49.LP
50
51.LP
52.LP
53The \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:
54.LP
55.RS 3
56
57.LP
58.nf
59\f3
60.fl
61import java.awt.*;
62.fl
63import java.applet.*;
64.fl
65
66.fl
67public 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
103The output from \f3javap DocFooter\fP yields:
104.LP
105.RS 3
106
107.LP
108.nf
109\f3
110.fl
111Compiled from DocFooter.java
112.fl
113public 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
133The output from \f3javap \-c DocFooter\fP yields:
134.LP
135.RS 3
136
137.LP
138.nf
139\f3
140.fl
141Compiled from DocFooter.java
142.fl
143public 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
159Method 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
169Method 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
203Method 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.TP 3
255\-help
256Prints out help message for \f3javap\fP.
257.TP 3
258\-l
259Prints out line and local variable tables.
260.TP 3
261\-b
262Ensures backward compatibility with \f3javap\fP in JDK 1.1.
263.TP 3
264\-public
265Shows only public classes and members.
266.TP 3
267\-protected
268Shows only protected and public classes and members.
269.TP 3
270\-package
271Shows only package, protected, and public classes and members. This is the default.
272.TP 3
273\-private
274Shows all classes and members.
275.TP 3
276\-Jflag
277Pass \f2flag\fP directly to the runtime system. Some examples:
278.RS 3
279
280.LP
281.nf
282\f3
283.fl
284javap \-J\-version
285.fl
286javap \-J\-Djava.security.manager \-J\-Djava.security.policy=MyPolicy MyClassName
287.fl
288\fP
289.fi
290.RE
291.TP 3
292\-s
293Prints internal type signatures.
294.TP 3
295\-c
296Prints 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
297.na
298\f2Java Virtual Machine Specification\fP @
299.fi
300http://java.sun.com/docs/books/vmspec/.
301.TP 3
302\-verbose
303Prints stack size, number of \f2locals\fP and \f2args\fP for methods.
304.TP 3
305\-classpath path
306Specifies 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:
307.nf
308\f3
309.fl
310 .:<your_path>
311.fl
312\fP
313.fi
314For example:
315.nf
316\f3
317.fl
318.:/home/avh/classes:/usr/local/java/classes
319.fl
320\fP
321.fi
322.TP 3
323\-bootclasspath path
324Specifies 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.
325.TP 3
326\-extdirs dirs
327Overrides location at which installed extensions are searched for. The default location for extensions is the value of \f2java.ext.dirs\fP.
328.LP
329.SH "ENVIRONMENT VARIABLES"
330.LP
331
332.LP
333.TP 3
334CLASSPATH
335Used to provide the system a path to user\-defined classes. Directories are separated by colons, for example, For example:
336.RS 3
337
338.LP
339.nf
340\f3
341.fl
342.:/home/avh/classes:/usr/local/java/classes
343.fl
344\fP
345.fi
346.RE
347
348.LP
349.SH "SEE ALSO"
350.LP
351
352.LP
353.LP
354javac, java, jdb, javah, javadoc
355.LP
356
357.LP
358