blob: 2580bf124513ee3603102d52af11b1eeb5611daf [file] [log] [blame]
rgallardb6435452013-11-25 20:19:02 -08001'\" t
rgallard36ba8532014-06-06 15:45:48 -07002.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
3.\"
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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21.\" or visit www.oracle.com if you need additional information or have any
22.\" questions.
23.\"
24.\" Title: javap
25.\" Language: English
26.\" Date: 8 August 2014
27.\" SectDesc: Basic Tools
28.\" Software: JDK 8
29.\" Arch: generic
30.\" Part Number: E38207-03
rgallardb6435452013-11-25 20:19:02 -080031.\"
32.if n .pl 99999
rgallard36ba8532014-06-06 15:45:48 -070033.TH "javap" "1" "8 August 2014" "JDK 8" "Basic Tools"
34.\" -----------------------------------------------------------------
35.\" * Define some portability stuff
36.\" -----------------------------------------------------------------
37.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38.\" http://bugs.debian.org/507673
39.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
40.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41.ie \n(.g .ds Aq \(aq
42.el .ds Aq '
43.\" -----------------------------------------------------------------
44.\" * set default formatting
45.\" -----------------------------------------------------------------
46.\" disable hyphenation
47.nh
48.\" disable justification (adjust text to left margin only)
49.ad l
50.\" -----------------------------------------------------------------
51.\" * MAIN CONTENT STARTS HERE *
52.\" -----------------------------------------------------------------
53.SH "NAME"
rgallardb6435452013-11-25 20:19:02 -080054javap \- Disassembles one or more class files\&.
rgallard36ba8532014-06-06 15:45:48 -070055.SH "SYNOPSIS"
56.sp
57.if n \{\
58.RS 4
59.\}
60.nf
rgallardb6435452013-11-25 20:19:02 -080061\fBjavap\fR [\fIoptions\fR] \fIclassfile\fR\&.\&.\&.
rgallard36ba8532014-06-06 15:45:48 -070062.fi
63.if n \{\
64.RE
65.\}
66.PP
rgallardb6435452013-11-25 20:19:02 -080067\fIoptions\fR
rgallard36ba8532014-06-06 15:45:48 -070068.RS 4
69The command\-line options\&. See Options\&.
70.RE
71.PP
rgallardb6435452013-11-25 20:19:02 -080072\fIclassfile\fR
rgallard36ba8532014-06-06 15:45:48 -070073.RS 4
74One or more classes separated by spaces to be processed for annotations such as DocFooter\&.class\&. You can specify a class that can be found in the class path, by its file name or with a URL such as
75\fBfile:///home/user/myproject/src/DocFooter\&.class\fR\&.
76.RE
77.SH "DESCRIPTION"
78.PP
79The
80\fBjavap\fR
81command disassembles one or more class files\&. The output depends on the options used\&. When no options are used, then the
82\fBjavap\fR
83command prints the package, protected and public fields, and methods of the classes passed to it\&. The
84\fBjavap\fR
85command prints its output to
86\fBstdout\fR\&.
87.SH "OPTIONS"
88.PP
89\-help
rgallardb6435452013-11-25 20:19:02 -080090.br
rgallard36ba8532014-06-06 15:45:48 -070091\-\-help
rgallardb6435452013-11-25 20:19:02 -080092.br
rgallard36ba8532014-06-06 15:45:48 -070093\-?
94.RS 4
95Prints a help message for the
96\fBjavap\fR
97command\&.
98.RE
99.PP
100\-version
101.RS 4
rgallardb6435452013-11-25 20:19:02 -0800102Prints release information\&.
rgallard36ba8532014-06-06 15:45:48 -0700103.RE
104.PP
105\-l
106.RS 4
rgallardb6435452013-11-25 20:19:02 -0800107Prints line and local variable tables\&.
rgallard36ba8532014-06-06 15:45:48 -0700108.RE
109.PP
110\-public
111.RS 4
rgallardb6435452013-11-25 20:19:02 -0800112Shows only public classes and members\&.
rgallard36ba8532014-06-06 15:45:48 -0700113.RE
114.PP
115\-protected
116.RS 4
rgallardb6435452013-11-25 20:19:02 -0800117Shows only protected and public classes and members\&.
rgallard36ba8532014-06-06 15:45:48 -0700118.RE
119.PP
120\-private
rgallardb6435452013-11-25 20:19:02 -0800121.br
rgallard36ba8532014-06-06 15:45:48 -0700122\-p
123.RS 4
rgallardb6435452013-11-25 20:19:02 -0800124Shows all classes and members\&.
rgallard36ba8532014-06-06 15:45:48 -0700125.RE
126.PP
127\-J\fIoption\fR
128.RS 4
rgallardb6435452013-11-25 20:19:02 -0800129Passes the specified option to the JVM\&. For example:
rgallard36ba8532014-06-06 15:45:48 -0700130.sp
131.if n \{\
132.RS 4
133.\}
134.nf
135\fBjavap \-J\-version\fR
136\fBjavap \-J\-Djava\&.security\&.manager \-J\-Djava\&.security\&.policy=MyPolicy MyClassName\fR
137
138.fi
139.if n \{\
140.RE
141.\}
142For more information about JVM options, see the command documentation\&.
143.RE
144.PP
145\-s
146.RS 4
rgallardb6435452013-11-25 20:19:02 -0800147Prints internal type signatures\&.
rgallard36ba8532014-06-06 15:45:48 -0700148.RE
149.PP
150\-sysinfo
151.RS 4
rgallardb6435452013-11-25 20:19:02 -0800152Shows system information (path, size, date, MD5 hash) of the class being processed\&.
rgallard36ba8532014-06-06 15:45:48 -0700153.RE
154.PP
155\-constants
156.RS 4
157Shows
158\fBstatic final\fR
159constants\&.
160.RE
161.PP
162\-c
163.RS 4
rgallardb6435452013-11-25 20:19:02 -0800164Prints disassembled code, for example, the instructions that comprise the Java bytecodes, for each of the methods in the class\&.
rgallard36ba8532014-06-06 15:45:48 -0700165.RE
166.PP
167\-verbose
168.RS 4
rgallardb6435452013-11-25 20:19:02 -0800169Prints stack size, number of locals and arguments for methods\&.
rgallard36ba8532014-06-06 15:45:48 -0700170.RE
171.PP
172\-classpath \fIpath\fR
173.RS 4
174Specifies the path the
175\fBjavap\fR
176command uses to look up classes\&. Overrides the default or the
177\fBCLASSPATH\fR
178environment variable when it is set\&.
179.RE
180.PP
181\-bootclasspath \fIpath\fR
182.RS 4
183Specifies the path from which to load bootstrap classes\&. By default, the bootstrap classes are the classes that implement the core Java platform located in
184\fBjre/lib/rt\&.jar\fR
185and several other JAR files\&.
186.RE
187.PP
188\-extdir \fIdirs\fR
189.RS 4
190Overrides the location at which installed extensions are searched for\&. The default location for extensions is the value of
191\fBjava\&.ext\&.dirs\fR\&.
192.RE
193.SH "EXAMPLE"
194.PP
195Compile the following
196\fBDocFooter\fR
197class:
198.sp
199.if n \{\
200.RS 4
201.\}
202.nf
203\fBimport java\&.awt\&.*;\fR
204\fBimport java\&.applet\&.*;\fR
205\fB \fR
206\fBpublic class DocFooter extends Applet {\fR
207\fB String date;\fR
208\fB String email;\fR
209\fB \fR
210\fB public void init() {\fR
211\fB resize(500,100);\fR
212\fB date = getParameter("LAST_UPDATED");\fR
213\fB email = getParameter("EMAIL");\fR
214\fB }\fR
215\fB \fR
216\fB public void paint(Graphics g) {\fR
217\fB g\&.drawString(date + " by ",100, 15);\fR
218\fB g\&.drawString(email,290,15);\fR
219\fB }\fR
220\fB}\fR
221
222.fi
223.if n \{\
224.RE
225.\}
226.PP
227The output from the
228\fBjavap DocFooter\&.class\fR
229command yields the following:
230.sp
231.if n \{\
232.RS 4
233.\}
234.nf
235\fBCompiled from "DocFooter\&.java"\fR
236\fBpublic class DocFooter extends java\&.applet\&.Applet {\fR
237\fB java\&.lang\&.String date;\fR
238\fB java\&.lang\&.String email;\fR
239\fB public DocFooter();\fR
240\fB public void init();\fR
241\fB public void paint(java\&.awt\&.Graphics);\fR
242\fB}\fR
243
244.fi
245.if n \{\
246.RE
247.\}
248.PP
249The output from
250\fBjavap \-c DocFooter\&.class\fR
251command yields the following:
252.sp
253.if n \{\
254.RS 4
255.\}
256.nf
257\fBCompiled from "DocFooter\&.java"\fR
258\fBpublic class DocFooter extends java\&.applet\&.Applet {\fR
259\fB java\&.lang\&.String date;\fR
260\fB java\&.lang\&.String email;\fR
261
262\fB public DocFooter();\fR
263\fB Code:\fR
264\fB 0: aload_0 \fR
265\fB 1: invokespecial #1 // Method\fR
266\fBjava/applet/Applet\&."<init>":()V\fR
267\fB 4: return \fR
268
269\fB public void init();\fR
270\fB Code:\fR
271\fB 0: aload_0 \fR
272\fB 1: sipush 500\fR
273\fB 4: bipush 100\fR
274\fB 6: invokevirtual #2 // Method resize:(II)V\fR
275\fB 9: aload_0 \fR
276\fB 10: aload_0 \fR
277\fB 11: ldc #3 // String LAST_UPDATED\fR
278\fB 13: invokevirtual #4 // Method\fR
279\fB getParameter:(Ljava/lang/String;)Ljava/lang/String;\fR
280\fB 16: putfield #5 // Field date:Ljava/lang/String;\fR
281\fB 19: aload_0 \fR
282\fB 20: aload_0 \fR
283\fB 21: ldc #6 // String EMAIL\fR
284\fB 23: invokevirtual #4 // Method\fR
285\fB getParameter:(Ljava/lang/String;)Ljava/lang/String;\fR
286\fB 26: putfield #7 // Field email:Ljava/lang/String;\fR
287\fB 29: return \fR
288
289\fB public void paint(java\&.awt\&.Graphics);\fR
290\fB Code:\fR
291\fB 0: aload_1 \fR
292\fB 1: new #8 // class java/lang/StringBuilder\fR
293\fB 4: dup \fR
294\fB 5: invokespecial #9 // Method\fR
295\fB java/lang/StringBuilder\&."<init>":()V\fR
296\fB 8: aload_0 \fR
297\fB 9: getfield #5 // Field date:Ljava/lang/String;\fR
298\fB 12: invokevirtual #10 // Method\fR
299\fB java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fR
300\fB 15: ldc #11 // String by \fR
301\fB 17: invokevirtual #10 // Method\fR
302\fB java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fR
303\fB 20: invokevirtual #12 // Method\fR
304\fB java/lang/StringBuilder\&.toString:()Ljava/lang/String;\fR
305\fB 23: bipush 100\fR
306\fB 25: bipush 15\fR
307\fB 27: invokevirtual #13 // Method\fR
308\fB java/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fR
309\fB 30: aload_1 \fR
310\fB 31: aload_0 \fR
311\fB 32: getfield #7 // Field email:Ljava/lang/String;\fR
312\fB 35: sipush 290\fR
313\fB 38: bipush 15\fR
314\fB 40: invokevirtual #13 // Method\fR
315\fBjava/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fR
316\fB 43: return \fR
317\fB}\fR
318
319.fi
320.if n \{\
321.RE
322.\}
323.SH "SEE ALSO"
324.sp
325.RS 4
326.ie n \{\
327\h'-04'\(bu\h'+03'\c
328.\}
329.el \{\
330.sp -1
331.IP \(bu 2.3
332.\}
rgallardb6435452013-11-25 20:19:02 -0800333java(1)
rgallard36ba8532014-06-06 15:45:48 -0700334.RE
335.sp
336.RS 4
337.ie n \{\
338\h'-04'\(bu\h'+03'\c
339.\}
340.el \{\
341.sp -1
342.IP \(bu 2.3
343.\}
344javac(1)
345.RE
346.sp
347.RS 4
348.ie n \{\
349\h'-04'\(bu\h'+03'\c
350.\}
351.el \{\
352.sp -1
353.IP \(bu 2.3
354.\}
rgallardb6435452013-11-25 20:19:02 -0800355javadoc(1)
rgallard36ba8532014-06-06 15:45:48 -0700356.RE
357.sp
358.RS 4
359.ie n \{\
360\h'-04'\(bu\h'+03'\c
361.\}
362.el \{\
363.sp -1
364.IP \(bu 2.3
365.\}
366javah(1)
367.RE
368.sp
369.RS 4
370.ie n \{\
371\h'-04'\(bu\h'+03'\c
372.\}
373.el \{\
374.sp -1
375.IP \(bu 2.3
376.\}
377jdb(1)
378.RE
379.sp
380.RS 4
381.ie n \{\
382\h'-04'\(bu\h'+03'\c
383.\}
384.el \{\
385.sp -1
386.IP \(bu 2.3
387.\}
388jdeps(1)
389.RE
390.br
391'pl 8.5i
392'bp