blob: 353a13fb0fd87c4ca3490d18cf961c9a5380fb02 [file] [log] [blame]
rgallardb6435452013-11-25 20:19:02 -08001'\" t
2.\" Copyright (c) 1994, 2013, 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.\" Arch: generic
25.\" Software: JDK 8
26.\" Date: 21 November 2013
27.\" SectDesc: Basic Tools
28.\" Title: javap.1
29.\"
30.if n .pl 99999
31.TH javap 1 "21 November 2013" "JDK 8" "Basic Tools"
32.\" -----------------------------------------------------------------
33.\" * Define some portability stuff
34.\" -----------------------------------------------------------------
35.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36.\" http://bugs.debian.org/507673
37.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
38.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39.ie \n(.g .ds Aq \(aq
40.el .ds Aq '
41.\" -----------------------------------------------------------------
42.\" * set default formatting
43.\" -----------------------------------------------------------------
44.\" disable hyphenation
45.nh
46.\" disable justification (adjust text to left margin only)
47.ad l
48.\" -----------------------------------------------------------------
49.\" * MAIN CONTENT STARTS HERE *
50.\" -----------------------------------------------------------------
duke6e45e102007-12-01 00:00:00 +000051
rgallardb6435452013-11-25 20:19:02 -080052.SH NAME
53javap \- Disassembles one or more class files\&.
54.SH SYNOPSIS
55.sp
56.nf
duke6e45e102007-12-01 00:00:00 +000057
rgallardb6435452013-11-25 20:19:02 -080058\fBjavap\fR [\fIoptions\fR] \fIclassfile\fR\&.\&.\&.
59.fi
60.sp
61.TP
62\fIoptions\fR
63The command-line options\&. See Options\&.
64.TP
65\fIclassfile\fR
66One 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 \f3file:///home/user/myproject/src/DocFooter\&.class\fR\&.
67.SH DESCRIPTION
68The \f3javap\fR command disassembles one or more class files\&. The output depends on the options used\&. When no options are used, then the \f3javap\fR command prints the package, protected and public fields, and methods of the classes passed to it\&. The \f3javap\fR command prints its output to \f3stdout\fR\&.
69.SH OPTIONS
70.TP
71-help, --help, -?
72.br
73Prints a help message for the \f3javap\fR command\&.
74.TP
75-version
76.br
77Prints release information\&.
78.TP
79-l
80.br
81Prints line and local variable tables\&.
82.TP
83-public
84.br
85Shows only public classes and members\&.
86.TP
87-protected
88.br
89Shows only protected and public classes and members\&.
90.TP
91-private, -p
92.br
93Shows all classes and members\&.
94.TP
95-J\fIoption\fR
96.br
97Passes the specified option to the JVM\&. For example:
98.sp
99.nf
100\f3javap \-J\-version\fP
101.fi
102.nf
103\f3javap \-J\-Djava\&.security\&.manager \-J\-Djava\&.security\&.policy=MyPolicy MyClassName\fP
104.fi
105.nf
106\f3\fP
107.fi
108.sp
duke6e45e102007-12-01 00:00:00 +0000109
duke6e45e102007-12-01 00:00:00 +0000110
rgallardb6435452013-11-25 20:19:02 -0800111For more information about JVM options, see the \f3java(1)\fR command documentation\&.
112.TP
113-s
114.br
115Prints internal type signatures\&.
116.TP
117-sysinfo
118.br
119Shows system information (path, size, date, MD5 hash) of the class being processed\&.
120.TP
121-constants
122.br
123Shows \f3static final\fR constants\&.
124.TP
125-c
126.br
127Prints disassembled code, for example, the instructions that comprise the Java bytecodes, for each of the methods in the class\&.
128.TP
129-verbose
130.br
131Prints stack size, number of locals and arguments for methods\&.
132.TP
133-classpath \fIpath\fR
134.br
135Specifies the path the \f3javap\fR command uses to look up classes\&. Overrides the default or the \f3CLASSPATH\fR environment variable when it is set\&.
136.TP
137-bootclasspath \fIpath\fR
138.br
139Specifies the path from which to load bootstrap classes\&. By default, the bootstrap classes are the classes that implement the core Java platform located in \f3jre/lib/rt\&.jar\fR and several other JAR files\&.
140.TP
141-extdir \fIdirs\fR
142.br
143Overrides the location at which installed extensions are searched for\&. The default location for extensions is the value of \f3java\&.ext\&.dirs\fR\&.
144.SH EXAMPLE
145Compile the following \f3DocFooter\fR class:
146.sp
147.nf
148\f3import java\&.awt\&.*;\fP
149.fi
150.nf
151\f3import java\&.applet\&.*;\fP
152.fi
153.nf
154\f3\fP
155.fi
156.nf
157\f3public class DocFooter extends Applet {\fP
158.fi
159.nf
160\f3 String date;\fP
161.fi
162.nf
163\f3 String email;\fP
164.fi
165.nf
166\f3\fP
167.fi
168.nf
169\f3 public void init() {\fP
170.fi
171.nf
172\f3 resize(500,100);\fP
173.fi
174.nf
175\f3 date = getParameter("LAST_UPDATED");\fP
176.fi
177.nf
178\f3 email = getParameter("EMAIL");\fP
179.fi
180.nf
181\f3 }\fP
182.fi
183.nf
184\f3\fP
185.fi
186.nf
187\f3 public void paint(Graphics g) {\fP
188.fi
189.nf
190\f3 g\&.drawString(date + " by ",100, 15);\fP
191.fi
192.nf
193\f3 g\&.drawString(email,290,15);\fP
194.fi
195.nf
196\f3 }\fP
197.fi
198.nf
199\f3}\fP
200.fi
201.nf
202\f3\fP
203.fi
204.sp
205The output from the \f3javap DocFooter\&.class\fR command yields the following:
206.sp
207.nf
208\f3Compiled from "DocFooter\&.java"\fP
209.fi
210.nf
211\f3public class DocFooter extends java\&.applet\&.Applet {\fP
212.fi
213.nf
214\f3 java\&.lang\&.String date;\fP
215.fi
216.nf
217\f3 java\&.lang\&.String email;\fP
218.fi
219.nf
220\f3 public DocFooter();\fP
221.fi
222.nf
223\f3 public void init();\fP
224.fi
225.nf
226\f3 public void paint(java\&.awt\&.Graphics);\fP
227.fi
228.nf
229\f3}\fP
230.fi
231.nf
232\f3\fP
233.fi
234.sp
235The output from \f3javap -c DocFooter\&.class\fR command yields the following:
236.sp
237.nf
238\f3Compiled from "DocFooter\&.java"\fP
239.fi
240.nf
241\f3public class DocFooter extends java\&.applet\&.Applet {\fP
242.fi
243.nf
244\f3 java\&.lang\&.String date;\fP
245.fi
246.nf
247\f3 java\&.lang\&.String email;\fP
248.fi
249.nf
250\f3\fP
251.fi
252.nf
253\f3 public DocFooter();\fP
254.fi
255.nf
256\f3 Code:\fP
257.fi
258.nf
259\f3 0: aload_0 \fP
260.fi
261.nf
262\f3 1: invokespecial #1 // Method\fP
263.fi
264.nf
265\f3java/applet/Applet\&."<init>":()V\fP
266.fi
267.nf
268\f3 4: return \fP
269.fi
270.nf
271\f3\fP
272.fi
273.nf
274\f3 public void init();\fP
275.fi
276.nf
277\f3 Code:\fP
278.fi
279.nf
280\f3 0: aload_0 \fP
281.fi
282.nf
283\f3 1: sipush 500\fP
284.fi
285.nf
286\f3 4: bipush 100\fP
287.fi
288.nf
289\f3 6: invokevirtual #2 // Method resize:(II)V\fP
290.fi
291.nf
292\f3 9: aload_0 \fP
293.fi
294.nf
295\f3 10: aload_0 \fP
296.fi
297.nf
298\f3 11: ldc #3 // String LAST_UPDATED\fP
299.fi
300.nf
301\f3 13: invokevirtual #4 // Method\fP
302.fi
303.nf
304\f3 getParameter:(Ljava/lang/String;)Ljava/lang/String;\fP
305.fi
306.nf
307\f3 16: putfield #5 // Field date:Ljava/lang/String;\fP
308.fi
309.nf
310\f3 19: aload_0 \fP
311.fi
312.nf
313\f3 20: aload_0 \fP
314.fi
315.nf
316\f3 21: ldc #6 // String EMAIL\fP
317.fi
318.nf
319\f3 23: invokevirtual #4 // Method\fP
320.fi
321.nf
322\f3 getParameter:(Ljava/lang/String;)Ljava/lang/String;\fP
323.fi
324.nf
325\f3 26: putfield #7 // Field email:Ljava/lang/String;\fP
326.fi
327.nf
328\f3 29: return \fP
329.fi
330.nf
331\f3\fP
332.fi
333.nf
334\f3 public void paint(java\&.awt\&.Graphics);\fP
335.fi
336.nf
337\f3 Code:\fP
338.fi
339.nf
340\f3 0: aload_1 \fP
341.fi
342.nf
343\f3 1: new #8 // class java/lang/StringBuilder\fP
344.fi
345.nf
346\f3 4: dup \fP
347.fi
348.nf
349\f3 5: invokespecial #9 // Method\fP
350.fi
351.nf
352\f3 java/lang/StringBuilder\&."<init>":()V\fP
353.fi
354.nf
355\f3 8: aload_0 \fP
356.fi
357.nf
358\f3 9: getfield #5 // Field date:Ljava/lang/String;\fP
359.fi
360.nf
361\f3 12: invokevirtual #10 // Method\fP
362.fi
363.nf
364\f3 java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fP
365.fi
366.nf
367\f3 15: ldc #11 // String by \fP
368.fi
369.nf
370\f3 17: invokevirtual #10 // Method\fP
371.fi
372.nf
373\f3 java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fP
374.fi
375.nf
376\f3 20: invokevirtual #12 // Method\fP
377.fi
378.nf
379\f3 java/lang/StringBuilder\&.toString:()Ljava/lang/String;\fP
380.fi
381.nf
382\f3 23: bipush 100\fP
383.fi
384.nf
385\f3 25: bipush 15\fP
386.fi
387.nf
388\f3 27: invokevirtual #13 // Method\fP
389.fi
390.nf
391\f3 java/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fP
392.fi
393.nf
394\f3 30: aload_1 \fP
395.fi
396.nf
397\f3 31: aload_0 \fP
398.fi
399.nf
400\f3 32: getfield #7 // Field email:Ljava/lang/String;\fP
401.fi
402.nf
403\f3 35: sipush 290\fP
404.fi
405.nf
406\f3 38: bipush 15\fP
407.fi
408.nf
409\f3 40: invokevirtual #13 // Method\fP
410.fi
411.nf
412\f3java/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fP
413.fi
414.nf
415\f3 43: return \fP
416.fi
417.nf
418\f3}\fP
419.fi
420.nf
421\f3\fP
422.fi
423.sp
424.SH SEE\ ALSO
425.TP 0.2i
426\(bu
427javac(1)
428.TP 0.2i
429\(bu
430java(1)
431.TP 0.2i
432\(bu
433jdb(1)
434.TP 0.2i
435\(bu
436javah(1)
437.TP 0.2i
438\(bu
439javadoc(1)
440.RE
441.br
442'pl 8.5i
443'bp