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, SHA\-256 hash) of the class
 135 being 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]\-\-multi\-release\f[R] \f[I]version\f[R]
 173 Specifies the version to select in multi\-release JAR files.
 174 .RS
 175 .RE
 176 .TP
 177 .B \f[CB]\-J\f[R]\f[I]option\f[R]
 178 Passes the specified option to the JVM.
 179 For example:
 180 .RS
 181 .IP
 182 .nf
 183 \f[CB]
 184 javap\ \-J\-version
 185 
 186 javap\ \-J\-Djava.security.manager\ \-J\-Djava.security.policy=MyPolicy\ MyClassName
 187 \f[R]
 188 .fi
 189 .PP
 190 See \f[I]Overview of Java Options\f[R] in \f[B]java\f[R].
 191 .RE
 192 .SH JAVAP EXAMPLE
 193 .PP
 194 Compile the following \f[CB]HelloWorldFrame\f[R] class:
 195 .IP
 196 .nf
 197 \f[CB]
 198 import\ java.awt.Graphics;
 199 
 200 import\ javax.swing.JFrame;
 201 import\ javax.swing.JPanel;
 202 
 203 public\ class\ HelloWorldFrame\ extends\ JFrame\ {
 204 
 205 \ \ \ String\ message\ =\ "Hello\ World!";
 206 
 207 \ \ \ public\ HelloWorldFrame(){
 208 \ \ \ \ \ \ \ \ setContentPane(new\ JPanel(){
 209 \ \ \ \ \ \ \ \ \ \ \ \ \@Override
 210 \ \ \ \ \ \ \ \ \ \ \ \ protected\ void\ paintComponent(Graphics\ g)\ {
 211 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ g.drawString(message,\ 15,\ 30);
 212 \ \ \ \ \ \ \ \ \ \ \ \ }
 213 \ \ \ \ \ \ \ \ });
 214 \ \ \ \ \ \ \ \ setSize(100,\ 100);
 215 \ \ \ \ }
 216 \ \ \ \ public\ static\ void\ main(String[]\ args)\ {
 217 \ \ \ \ \ \ \ \ HelloWorldFrame\ frame\ =\ new\ HelloWorldFrame();
 218 \ \ \ \ \ \ \ \ frame.setVisible(true);
 219 
 220 \ \ \ \ }
 221 
 222 }
 223 \f[R]
 224 .fi
 225 .PP
 226 The output from the \f[CB]javap\ HelloWorldFrame.class\f[R] command yields
 227 the following:
 228 .IP
 229 .nf
 230 \f[CB]
 231 Compiled\ from\ "HelloWorldFrame.java"
 232 public\ class\ HelloWorldFrame\ extends\ javax.swing.JFrame\ {
 233 \ \ java.lang.String\ message;
 234 \ \ public\ HelloWorldFrame();
 235 \ \ public\ static\ void\ main(java.lang.String[]);
 236 }
 237 \f[R]
 238 .fi
 239 .PP
 240 The output from the \f[CB]javap\ \-c\ HelloWorldFrame.class\f[R] command
 241 yields the following:
 242 .IP
 243 .nf
 244 \f[CB]
 245 Compiled\ from\ "HelloWorldFrame.java"
 246 public\ class\ HelloWorldFrame\ extends\ javax.swing.JFrame\ {
 247 \ \ java.lang.String\ message;
 248 
 249 \ \ public\ HelloWorldFrame();
 250 \ \ \ \ Code:
 251 \ \ \ \ \ \ \ 0:\ aload_0
 252 \ \ \ \ \ \ \ 1:\ invokespecial\ #1\ \ \ \ \ \ \ \ //\ Method\ javax/swing/JFrame."<init>":()V
 253 \ \ \ \ \ \ \ 4:\ aload_0
 254 \ \ \ \ \ \ \ 5:\ ldc\ \ \ \ \ \ \ \ \ \ \ #2\ \ \ \ \ \ \ \ //\ String\ Hello\ World!
 255 \ \ \ \ \ \ \ 7:\ putfield\ \ \ \ \ \ #3\ \ \ \ \ \ \ \ //\ Field\ message:Ljava/lang/String;
 256 \ \ \ \ \ \ 10:\ aload_0
 257 \ \ \ \ \ \ 11:\ new\ \ \ \ \ \ \ \ \ \ \ #4\ \ \ \ \ \ \ \ //\ class\ HelloWorldFrame$1
 258 \ \ \ \ \ \ 14:\ dup
 259 \ \ \ \ \ \ 15:\ aload_0
 260 \ \ \ \ \ \ 16:\ invokespecial\ #5\ \ \ \ \ \ \ \ //\ Method\ HelloWorldFrame$1."<init>":(LHelloWorldFrame;)V
 261 \ \ \ \ \ \ 19:\ invokevirtual\ #6\ \ \ \ \ \ \ \ //\ Method\ setContentPane:(Ljava/awt/Container;)V
 262 \ \ \ \ \ \ 22:\ aload_0
 263 \ \ \ \ \ \ 23:\ bipush\ \ \ \ \ \ \ \ 100
 264 \ \ \ \ \ \ 25:\ bipush\ \ \ \ \ \ \ \ 100
 265 \ \ \ \ \ \ 27:\ invokevirtual\ #7\ \ \ \ \ \ \ \ //\ Method\ setSize:(II)V
 266 \ \ \ \ \ \ 30:\ return
 267 
 268 \ \ public\ static\ void\ main(java.lang.String[]);
 269 \ \ \ \ Code:
 270 \ \ \ \ \ \ \ 0:\ new\ \ \ \ \ \ \ \ \ \ \ #8\ \ \ \ \ \ \ \ //\ class\ HelloWorldFrame
 271 \ \ \ \ \ \ \ 3:\ dup
 272 \ \ \ \ \ \ \ 4:\ invokespecial\ #9\ \ \ \ \ \ \ \ //\ Method\ "<init>":()V
 273 \ \ \ \ \ \ \ 7:\ astore_1
 274 \ \ \ \ \ \ \ 8:\ aload_1
 275 \ \ \ \ \ \ \ 9:\ iconst_1
 276 \ \ \ \ \ \ 10:\ invokevirtual\ #10\ \ \ \ \ \ \ //\ Method\ setVisible:(Z)V
 277 \ \ \ \ \ \ 13:\ return
 278 }
 279 \f[R]
 280 .fi