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