blob: aa6e8d0114cd9bce3fa4a25cdd6c9acda2e84c79 [file] [log] [blame]
bpatel4bf512b2011-05-11 08:30:46 -07001." Copyright (c) 1994, 2011, Oracle and/or its affiliates. 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."
bpatel4bf512b2011-05-11 08:30:46 -070022.TH javap 1 "10 May 2011"
duke6e45e102007-12-01 00:00:00 +000023
24.LP
tbell16c34dd2009-05-04 18:28:26 -070025.SH "Name"
duke6e45e102007-12-01 00:00:00 +000026javap \- The Java Class File Disassembler
27.LP
duke6e45e102007-12-01 00:00:00 +000028.LP
29Disassembles class files.
30.LP
31.SH "SYNOPSIS"
32.LP
duke6e45e102007-12-01 00:00:00 +000033.nf
34\f3
35.fl
bpatel4bf512b2011-05-11 08:30:46 -070036javap [ \fP\f3options\fP\f3 ] classes
duke6e45e102007-12-01 00:00:00 +000037.fl
38\fP
39.fi
40
41.LP
42.SH "DESCRIPTION"
43.LP
duke6e45e102007-12-01 00:00:00 +000044.LP
bpatel4bf512b2011-05-11 08:30:46 -070045The \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.
duke6e45e102007-12-01 00:00:00 +000046.LP
47.RS 3
bpatel4bf512b2011-05-11 08:30:46 -070048.TP 3
49options
50Command\-line options.
51.TP 3
52classes
53List 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).
54.RE
duke6e45e102007-12-01 00:00:00 +000055
56.LP
bpatel4bf512b2011-05-11 08:30:46 -070057.LP
58For example, compile the following class declaration:
59.LP
duke6e45e102007-12-01 00:00:00 +000060.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
duke6e45e102007-12-01 00:00:00 +0000101
102.LP
103.LP
bpatel4bf512b2011-05-11 08:30:46 -0700104The output from \f3javap DocFooter.class\fP yields:
duke6e45e102007-12-01 00:00:00 +0000105.LP
106.nf
107\f3
108.fl
bpatel4bf512b2011-05-11 08:30:46 -0700109Compiled from "DocFooter.java"
duke6e45e102007-12-01 00:00:00 +0000110.fl
111public class DocFooter extends java.applet.Applet {
112.fl
bpatel4bf512b2011-05-11 08:30:46 -0700113 java.lang.String date;
duke6e45e102007-12-01 00:00:00 +0000114.fl
bpatel4bf512b2011-05-11 08:30:46 -0700115 java.lang.String email;
duke6e45e102007-12-01 00:00:00 +0000116.fl
bpatel4bf512b2011-05-11 08:30:46 -0700117 public DocFooter();
duke6e45e102007-12-01 00:00:00 +0000118.fl
bpatel4bf512b2011-05-11 08:30:46 -0700119 public void init();
duke6e45e102007-12-01 00:00:00 +0000120.fl
bpatel4bf512b2011-05-11 08:30:46 -0700121 public void paint(java.awt.Graphics);
duke6e45e102007-12-01 00:00:00 +0000122.fl
123}
124.fl
125\fP
126.fi
duke6e45e102007-12-01 00:00:00 +0000127
128.LP
129.LP
bpatel4bf512b2011-05-11 08:30:46 -0700130The output from \f3javap \-c DocFooter.class\fP yields:
duke6e45e102007-12-01 00:00:00 +0000131.LP
132.nf
133\f3
134.fl
bpatel4bf512b2011-05-11 08:30:46 -0700135Compiled from "DocFooter.java"
duke6e45e102007-12-01 00:00:00 +0000136.fl
137public class DocFooter extends java.applet.Applet {
138.fl
bpatel4bf512b2011-05-11 08:30:46 -0700139 java.lang.String date;
duke6e45e102007-12-01 00:00:00 +0000140.fl
bpatel4bf512b2011-05-11 08:30:46 -0700141
duke6e45e102007-12-01 00:00:00 +0000142.fl
bpatel4bf512b2011-05-11 08:30:46 -0700143 java.lang.String email;
duke6e45e102007-12-01 00:00:00 +0000144.fl
bpatel4bf512b2011-05-11 08:30:46 -0700145
duke6e45e102007-12-01 00:00:00 +0000146.fl
bpatel4bf512b2011-05-11 08:30:46 -0700147 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
duke6e45e102007-12-01 00:00:00 +0000238.fl
239}
240.fl
duke6e45e102007-12-01 00:00:00 +0000241\fP
242.fi
duke6e45e102007-12-01 00:00:00 +0000243
244.LP
245.SH "OPTIONS"
246.LP
tbell16c34dd2009-05-04 18:28:26 -0700247.RS 3
duke6e45e102007-12-01 00:00:00 +0000248.TP 3
bpatel4bf512b2011-05-11 08:30:46 -0700249\-help \-\-help \-?
duke6e45e102007-12-01 00:00:00 +0000250Prints out help message for \f3javap\fP.
251.TP 3
bpatel4bf512b2011-05-11 08:30:46 -0700252\-version
253Prints out version information.
254.TP 3
duke6e45e102007-12-01 00:00:00 +0000255\-l
256Prints out line and local variable tables.
257.TP 3
duke6e45e102007-12-01 00:00:00 +0000258\-public
259Shows only public classes and members.
260.TP 3
261\-protected
262Shows only protected and public classes and members.
263.TP 3
264\-package
265Shows only package, protected, and public classes and members. This is the default.
266.TP 3
bpatel4bf512b2011-05-11 08:30:46 -0700267\-private \-p
duke6e45e102007-12-01 00:00:00 +0000268Shows all classes and members.
269.TP 3
270\-Jflag
271Pass \f2flag\fP directly to the runtime system. Some examples:
duke6e45e102007-12-01 00:00:00 +0000272.nf
273\f3
274.fl
275javap \-J\-version
276.fl
277javap \-J\-Djava.security.manager \-J\-Djava.security.policy=MyPolicy MyClassName
278.fl
279\fP
280.fi
duke6e45e102007-12-01 00:00:00 +0000281.TP 3
282\-s
283Prints internal type signatures.
284.TP 3
bpatel4bf512b2011-05-11 08:30:46 -0700285\-sysinfo
286Shows system information (path, size, date, MD5 hash) of the class being processed.
287.TP 3
288\-constants
289Shows static final constants.
290.TP 3
duke6e45e102007-12-01 00:00:00 +0000291\-c
292Prints 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
293.na
294\f2Java Virtual Machine Specification\fP @
295.fi
296http://java.sun.com/docs/books/vmspec/.
297.TP 3
298\-verbose
299Prints stack size, number of \f2locals\fP and \f2args\fP for methods.
300.TP 3
301\-classpath path
bpatel4bf512b2011-05-11 08:30:46 -0700302Specifies the path \f3javap\fP uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set.
duke6e45e102007-12-01 00:00:00 +0000303.TP 3
304\-bootclasspath path
305Specifies 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.
306.TP 3
307\-extdirs dirs
308Overrides 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 -0700309.RE
310
duke6e45e102007-12-01 00:00:00 +0000311.LP
duke6e45e102007-12-01 00:00:00 +0000312.SH "SEE ALSO"
313.LP
duke6e45e102007-12-01 00:00:00 +0000314.LP
tbell16c34dd2009-05-04 18:28:26 -0700315javac(1), java(1), jdb(1), javah(1), javadoc(1)
duke6e45e102007-12-01 00:00:00 +0000316.LP
duke6e45e102007-12-01 00:00:00 +0000317