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