javap.1 revision 5116:d45bc4307996
1." Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. 2." 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." 18." 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. 21." 22.TH javap 1 "10 May 2011" 23 24.LP 25.SH "Name" 26javap \- The Java Class File Disassembler 27.LP 28.LP 29Disassembles class files. 30.LP 31.SH "SYNOPSIS" 32.LP 33.nf 34\f3 35.fl 36javap [ \fP\f3options\fP\f3 ] classes 37.fl 38\fP 39.fi 40 41.LP 42.SH "DESCRIPTION" 43.LP 44.LP 45The \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. 46.LP 47.RS 3 48.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 55 56.LP 57.LP 58For example, compile the following class declaration: 59.LP 60.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 101 102.LP 103.LP 104The output from \f3javap DocFooter.class\fP yields: 105.LP 106.nf 107\f3 108.fl 109Compiled from "DocFooter.java" 110.fl 111public class DocFooter extends java.applet.Applet { 112.fl 113 java.lang.String date; 114.fl 115 java.lang.String email; 116.fl 117 public DocFooter(); 118.fl 119 public void init(); 120.fl 121 public void paint(java.awt.Graphics); 122.fl 123} 124.fl 125\fP 126.fi 127 128.LP 129.LP 130The output from \f3javap \-c DocFooter.class\fP yields: 131.LP 132.nf 133\f3 134.fl 135Compiled from "DocFooter.java" 136.fl 137public class DocFooter extends java.applet.Applet { 138.fl 139 java.lang.String date; 140.fl 141 142.fl 143 java.lang.String email; 144.fl 145 146.fl 147 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 238.fl 239} 240.fl 241\fP 242.fi 243 244.LP 245.SH "OPTIONS" 246.LP 247.RS 3 248.TP 3 249\-help \-\-help \-? 250Prints out help message for \f3javap\fP. 251.TP 3 252\-version 253Prints out version information. 254.TP 3 255\-l 256Prints out line and local variable tables. 257.TP 3 258\-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 267\-private \-p 268Shows all classes and members. 269.TP 3 270\-Jflag 271Pass \f2flag\fP directly to the runtime system. Some examples: 272.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 281.TP 3 282\-s 283Prints internal type signatures. 284.TP 3 285\-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 291\-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 302Specifies the path \f3javap\fP uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set. 303.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. 309.RE 310 311.LP 312.SH "SEE ALSO" 313.LP 314.LP 315javac(1), java(1), jdb(1), javah(1), javadoc(1) 316.LP 317 318