1 .\" Copyright (c) 1994, 2019, 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 .\" Automatically generated by Pandoc 2.3.1 23 .\" 24 .TH "JAVAP" "1" "2018" "JDK 13" "JDK Commands" 25 .hy 26 .SH NAME 27 .PP 28 javap \- disassemble one or more class files 29 .SH SYNOPSIS 30 .PP 31 \f[CB]javap\f[R] [\f[I]options\f[R]] \f[I]classes\f[R]... 32 .TP 33 .B \f[I]options\f[R] 34 Specifies the command\-line options. 35 See \f[B]Options for javap\f[R]. 36 .RS 37 .RE 38 .TP 39 .B \f[I]classes\f[R] 40 Specifies one or more classes separated by spaces to be processed for 41 annotations. 42 You can specify a class that can be found in the class path by its file 43 name, URL, or by its fully qualified class name. 44 .RS 45 .PP 46 Examples: 47 .RS 48 .PP 49 \f[CB]path/to/MyClass.class\f[R] 50 .RE 51 .RS 52 .PP 53 \f[CB]jar:file:///path/to/MyJar.jar!/mypkg/MyClass.class\f[R] 54 .RE 55 .RS 56 .PP 57 \f[CB]java.lang.Object\f[R] 58 .RE 59 .RE 60 .SH DESCRIPTION 61 .PP 62 The \f[CB]javap\f[R] command disassembles one or more class files. 63 The output depends on the options used. 64 When no options are used, the \f[CB]javap\f[R] command prints the 65 protected and public fields, and methods of the classes passed to it. 66 .PP 67 The \f[CB]javap\f[R] command isn\[aq]t multirelease JAR aware. 68 Using the class path form of the command results in viewing the base 69 entry in all JAR files, multirelease or not. 70 Using the URL form, you can use the URL form of an argument to specify a 71 specific version of a class to be disassembled. 72 .PP 73 The \f[CB]javap\f[R] command prints its output to \f[CB]stdout\f[R]. 74 .PP 75 \f[B]Note:\f[R] 76 .PP 77 In tools that support \f[CB]\-\-\f[R] style options, the GNU\-style 78 options can use the equal sign (\f[CB]=\f[R]) instead of a white space to 79 separate the name of an option from its value. 80 .SH OPTIONS FOR JAVAP 81 .TP 82 .B \f[CB]\-help\f[R], \f[CB]\-\-help\f[R] , or \f[CB]\-?\f[R] 83 Prints a help message for the \f[CB]javap\f[R] command. 84 .RS 85 .RE 86 .TP 87 .B \f[CB]\-version\f[R] 88 Prints release information. 89 .RS 90 .RE 91 .TP 92 .B \f[CB]\-verbose\f[R] or \f[CB]\-v\f[R] 93 Prints additional information about the selected class. 94 .RS 95 .RE 96 .TP 97 .B \f[CB]\-l\f[R] 98 Prints line and local variable tables. 99 .RS 100 .RE 101 .TP 102 .B \f[CB]\-public\f[R] 103 Shows only public classes and members. 104 .RS 105 .RE 106 .TP 107 .B \f[CB]\-protected\f[R] 108 Shows only protected and public classes and members. 109 .RS 110 .RE 111 .TP 112 .B \f[CB]\-package\f[R] 113 Shows package/protected/public classes and members (default). 114 .RS 115 .RE 116 .TP 117 .B \f[CB]\-private\f[R] or \f[CB]\-p\f[R] 118 Shows all classes and members. 119 .RS 120 .RE 121 .TP 122 .B \f[CB]\-c\f[R] 123 Prints disassembled code, for example, the instructions that comprise 124 the Java bytecodes, for each of the methods in the class. 125 .RS 126 .RE 127 .TP 128 .B \f[CB]\-s\f[R] 129 Prints internal type signatures. 130 .RS 131 .RE 132 .TP 133 .B \f[CB]\-sysinfo\f[R] 134 Shows system information (path, size, date, MD5 hash) of the class being 135 processed. 136 .RS 137 .RE 138 .TP 139 .B \f[CB]\-constants\f[R] 140 Shows \f[CB]static\ final\f[R] constants. 141 .RS 142 .RE 143 .TP 144 .B \f[CB]\-\-module\f[R] \f[I]module\f[R] or \f[CB]\-m\f[R] \f[I]module\f[R] 145 Specifies the module containing classes to be disassembled. 146 .RS 147 .RE 148 .TP 149 .B \f[CB]\-\-module\-path\f[R] \f[I]path\f[R] 150 Specifies where to find application modules. 151 .RS 152 .RE 153 .TP 154 .B \f[CB]\-\-system\f[R] \f[I]jdk\f[R] 155 Specifies where to find system modules. 156 .RS 157 .RE 158 .TP 159 .B \f[CB]\-\-class\-path\f[R] \f[I]path\f[R], \f[CB]\-classpath\f[R] \f[I]path\f[R], or \f[CB]\-cp\f[R] \f[I]path\f[R] 160 Specifies the path that the \f[CB]javap\f[R] command uses to find user 161 class files. 162 It overrides the default or the \f[CB]CLASSPATH\f[R] environment variable 163 when it\[aq]s set. 164 .RS 165 .RE 166 .TP 167 .B \f[CB]\-bootclasspath\f[R] \f[I]path\f[R] 168 Overrides the location of bootstrap class files. 169 .RS 170 .RE 171 .TP 172 .B \f[CB]\-J\f[R]\f[I]option\f[R] 173 Passes the specified option to the JVM. 174 For example: 175 .RS 176 .IP 177 .nf 178 \f[CB] 179 javap\ \-J\-version 180 181 javap\ \-J\-Djava.security.manager\ \-J\-Djava.security.policy=MyPolicy\ MyClassName 182 \f[R] 183 .fi 184 .PP 185 See \f[I]Overview of Java Options\f[R] in \f[B]java\f[R]. 186 .RE 187 .SH JAVAP EXAMPLE 188 .PP 189 Compile the following \f[CB]HelloWorldFrame\f[R] class: 190 .IP 191 .nf 192 \f[CB] 193 import\ java.awt.Graphics; 194 195 import\ javax.swing.JFrame; 196 import\ javax.swing.JPanel; 197 198 public\ class\ HelloWorldFrame\ extends\ JFrame\ { 199 200 \ \ \ String\ message\ =\ "Hello\ World!"; 201 202 \ \ \ public\ HelloWorldFrame(){ 203 \ \ \ \ \ \ \ \ setContentPane(new\ JPanel(){ 204 \ \ \ \ \ \ \ \ \ \ \ \ \@Override 205 \ \ \ \ \ \ \ \ \ \ \ \ protected\ void\ paintComponent(Graphics\ g)\ { 206 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ g.drawString(message,\ 15,\ 30); 207 \ \ \ \ \ \ \ \ \ \ \ \ } 208 \ \ \ \ \ \ \ \ }); 209 \ \ \ \ \ \ \ \ setSize(100,\ 100); 210 \ \ \ \ } 211 \ \ \ \ public\ static\ void\ main(String[]\ args)\ { 212 \ \ \ \ \ \ \ \ HelloWorldFrame\ frame\ =\ new\ HelloWorldFrame(); 213 \ \ \ \ \ \ \ \ frame.setVisible(true); 214 215 \ \ \ \ } 216 217 } 218 \f[R] 219 .fi 220 .PP 221 The output from the \f[CB]javap\ HelloWorldFrame.class\f[R] command yields 222 the following: 223 .IP 224 .nf 225 \f[CB] 226 Compiled\ from\ "HelloWorldFrame.java" 227 public\ class\ HelloWorldFrame\ extends\ javax.swing.JFrame\ { 228 \ \ java.lang.String\ message; 229 \ \ public\ HelloWorldFrame(); 230 \ \ public\ static\ void\ main(java.lang.String[]); 231 } 232 \f[R] 233 .fi 234 .PP 235 The output from the \f[CB]javap\ \-c\ HelloWorldFrame.class\f[R] command 236 yields the following: 237 .IP 238 .nf 239 \f[CB] 240 Compiled\ from\ "HelloWorldFrame.java" 241 public\ class\ HelloWorldFrame\ extends\ javax.swing.JFrame\ { 242 \ \ java.lang.String\ message; 243 244 \ \ public\ HelloWorldFrame(); 245 \ \ \ \ Code: 246 \ \ \ \ \ \ \ 0:\ aload_0 247 \ \ \ \ \ \ \ 1:\ invokespecial\ #1\ \ \ \ \ \ \ \ //\ Method\ javax/swing/JFrame."<init>":()V 248 \ \ \ \ \ \ \ 4:\ aload_0 249 \ \ \ \ \ \ \ 5:\ ldc\ \ \ \ \ \ \ \ \ \ \ #2\ \ \ \ \ \ \ \ //\ String\ Hello\ World! 250 \ \ \ \ \ \ \ 7:\ putfield\ \ \ \ \ \ #3\ \ \ \ \ \ \ \ //\ Field\ message:Ljava/lang/String; 251 \ \ \ \ \ \ 10:\ aload_0 252 \ \ \ \ \ \ 11:\ new\ \ \ \ \ \ \ \ \ \ \ #4\ \ \ \ \ \ \ \ //\ class\ HelloWorldFrame$1 253 \ \ \ \ \ \ 14:\ dup 254 \ \ \ \ \ \ 15:\ aload_0 255 \ \ \ \ \ \ 16:\ invokespecial\ #5\ \ \ \ \ \ \ \ //\ Method\ HelloWorldFrame$1."<init>":(LHelloWorldFrame;)V 256 \ \ \ \ \ \ 19:\ invokevirtual\ #6\ \ \ \ \ \ \ \ //\ Method\ setContentPane:(Ljava/awt/Container;)V 257 \ \ \ \ \ \ 22:\ aload_0 258 \ \ \ \ \ \ 23:\ bipush\ \ \ \ \ \ \ \ 100 259 \ \ \ \ \ \ 25:\ bipush\ \ \ \ \ \ \ \ 100 260 \ \ \ \ \ \ 27:\ invokevirtual\ #7\ \ \ \ \ \ \ \ //\ Method\ setSize:(II)V 261 \ \ \ \ \ \ 30:\ return 262 263 \ \ public\ static\ void\ main(java.lang.String[]); 264 \ \ \ \ Code: 265 \ \ \ \ \ \ \ 0:\ new\ \ \ \ \ \ \ \ \ \ \ #8\ \ \ \ \ \ \ \ //\ class\ HelloWorldFrame 266 \ \ \ \ \ \ \ 3:\ dup 267 \ \ \ \ \ \ \ 4:\ invokespecial\ #9\ \ \ \ \ \ \ \ //\ Method\ "<init>":()V 268 \ \ \ \ \ \ \ 7:\ astore_1 269 \ \ \ \ \ \ \ 8:\ aload_1 270 \ \ \ \ \ \ \ 9:\ iconst_1 271 \ \ \ \ \ \ 10:\ invokevirtual\ #10\ \ \ \ \ \ \ //\ Method\ setVisible:(Z)V 272 \ \ \ \ \ \ 13:\ return 273 } 274 \f[R] 275 .fi