< prev index next >

src/jdk.jdeps/share/man/javap.1

Print this page

        

*** 1,7 **** ! '\" t ! .\" 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. --- 1,6 ---- ! .\" Copyright (c) 1994, 2019, 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.
*** 18,380 **** .\" .\" 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 .\" ! .if n .pl 99999 ! .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" ! javap \- Disassembles one or more class files\&. ! .SH "SYNOPSIS" ! .sp ! .if n \{\ ! .RS 4 ! .\} .nf ! \fBjavap\fR [\fIoptions\fR] \fIclassfile\fR\&.\&.\&. ! .fi ! .if n \{\ ! .RE ! .\} ! .PP ! \fIoptions\fR ! .RS 4 ! The command\-line options\&. See Options\&. ! .RE ! .PP ! \fIclassfile\fR ! .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 ! .br ! \-\-help ! .br ! \-? ! .RS 4 ! Prints a help message for the ! \fBjavap\fR ! command\&. ! .RE ! .PP ! \-version ! .RS 4 ! Prints release information\&. ! .RE ! .PP ! \-l ! .RS 4 ! Prints line and local variable tables\&. ! .RE ! .PP ! \-public ! .RS 4 ! Shows only public classes and members\&. ! .RE ! .PP ! \-protected ! .RS 4 ! Shows only protected and public classes and members\&. ! .RE ! .PP ! \-private ! .br ! \-p ! .RS 4 ! Shows all classes and members\&. ! .RE ! .PP ! \-J\fIoption\fR ! .RS 4 ! Passes the specified option to the JVM\&. For example: ! .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 - Prints internal type signatures\&. - .RE - .PP - \-sysinfo - .RS 4 - Shows system information (path, size, date, MD5 hash) of the class being processed\&. - .RE - .PP - \-constants - .RS 4 - Shows - \fBstatic final\fR - constants\&. - .RE - .PP - \-c - .RS 4 - Prints disassembled code, for example, the instructions that comprise the Java bytecodes, for each of the methods in the class\&. - .RE - .PP - \-verbose - .RS 4 - Prints stack size, number of locals and arguments for methods\&. - .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 - .\} - java(1) - .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 - .\} - javadoc(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 --- 17,275 ---- .\" .\" 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. .\" ! .\" Automatically generated by Pandoc 2.3.1 .\" ! .TH "JAVAP" "1" "2018" "JDK 13" "JDK Commands" ! .hy ! .SH NAME ! .PP ! javap \- disassemble one or more class files ! .SH SYNOPSIS ! .PP ! \f[CB]javap\f[R] [\f[I]options\f[R]] \f[I]classes\f[R]... ! .TP ! .B \f[I]options\f[R] ! Specifies the command\-line options. ! See \f[B]Options for javap\f[R]. ! .RS ! .RE ! .TP ! .B \f[I]classes\f[R] ! Specifies one or more classes separated by spaces to be processed for ! annotations. ! You can specify a class that can be found in the class path by its file ! name, URL, or by its fully qualified class name. ! .RS ! .PP ! Examples: ! .RS ! .PP ! \f[CB]path/to/MyClass.class\f[R] ! .RE ! .RS ! .PP ! \f[CB]jar:file:///path/to/MyJar.jar!/mypkg/MyClass.class\f[R] ! .RE ! .RS ! .PP ! \f[CB]java.lang.Object\f[R] ! .RE ! .RE ! .SH DESCRIPTION ! .PP ! The \f[CB]javap\f[R] command disassembles one or more class files. ! The output depends on the options used. ! When no options are used, the \f[CB]javap\f[R] command prints the ! protected and public fields, and methods of the classes passed to it. ! .PP ! The \f[CB]javap\f[R] command isn\[aq]t multirelease JAR aware. ! Using the class path form of the command results in viewing the base ! entry in all JAR files, multirelease or not. ! Using the URL form, you can use the URL form of an argument to specify a ! specific version of a class to be disassembled. ! .PP ! The \f[CB]javap\f[R] command prints its output to \f[CB]stdout\f[R]. ! .PP ! \f[B]Note:\f[R] ! .PP ! In tools that support \f[CB]\-\-\f[R] style options, the GNU\-style ! options can use the equal sign (\f[CB]=\f[R]) instead of a white space to ! separate the name of an option from its value. ! .SH OPTIONS FOR JAVAP ! .TP ! .B \f[CB]\-help\f[R], \f[CB]\-\-help\f[R] , or \f[CB]\-?\f[R] ! Prints a help message for the \f[CB]javap\f[R] command. ! .RS ! .RE ! .TP ! .B \f[CB]\-version\f[R] ! Prints release information. ! .RS ! .RE ! .TP ! .B \f[CB]\-verbose\f[R] or \f[CB]\-v\f[R] ! Prints additional information about the selected class. ! .RS ! .RE ! .TP ! .B \f[CB]\-l\f[R] ! Prints line and local variable tables. ! .RS ! .RE ! .TP ! .B \f[CB]\-public\f[R] ! Shows only public classes and members. ! .RS ! .RE ! .TP ! .B \f[CB]\-protected\f[R] ! Shows only protected and public classes and members. ! .RS ! .RE ! .TP ! .B \f[CB]\-package\f[R] ! Shows package/protected/public classes and members (default). ! .RS ! .RE ! .TP ! .B \f[CB]\-private\f[R] or \f[CB]\-p\f[R] ! Shows all classes and members. ! .RS ! .RE ! .TP ! .B \f[CB]\-c\f[R] ! Prints disassembled code, for example, the instructions that comprise ! the Java bytecodes, for each of the methods in the class. ! .RS ! .RE ! .TP ! .B \f[CB]\-s\f[R] ! Prints internal type signatures. ! .RS ! .RE ! .TP ! .B \f[CB]\-sysinfo\f[R] ! Shows system information (path, size, date, MD5 hash) of the class being ! processed. ! .RS ! .RE ! .TP ! .B \f[CB]\-constants\f[R] ! Shows \f[CB]static\ final\f[R] constants. ! .RS ! .RE ! .TP ! .B \f[CB]\-\-module\f[R] \f[I]module\f[R] or \f[CB]\-m\f[R] \f[I]module\f[R] ! Specifies the module containing classes to be disassembled. ! .RS ! .RE ! .TP ! .B \f[CB]\-\-module\-path\f[R] \f[I]path\f[R] ! Specifies where to find application modules. ! .RS ! .RE ! .TP ! .B \f[CB]\-\-system\f[R] \f[I]jdk\f[R] ! Specifies where to find system modules. ! .RS ! .RE ! .TP ! .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] ! Specifies the path that the \f[CB]javap\f[R] command uses to find user ! class files. ! It overrides the default or the \f[CB]CLASSPATH\f[R] environment variable ! when it\[aq]s set. ! .RS ! .RE ! .TP ! .B \f[CB]\-bootclasspath\f[R] \f[I]path\f[R] ! Overrides the location of bootstrap class files. ! .RS ! .RE ! .TP ! .B \f[CB]\-J\f[R]\f[I]option\f[R] ! Passes the specified option to the JVM. ! For example: ! .RS ! .IP .nf ! \f[CB] ! javap\ \-J\-version + javap\ \-J\-Djava.security.manager\ \-J\-Djava.security.policy=MyPolicy\ MyClassName + \f[R] .fi .PP ! See \f[I]Overview of Java Options\f[R] in \f[B]java\f[R]. .RE ! .SH JAVAP EXAMPLE .PP ! Compile the following \f[CB]HelloWorldFrame\f[R] class: ! .IP .nf ! \f[CB] ! import\ java.awt.Graphics; ! ! import\ javax.swing.JFrame; ! import\ javax.swing.JPanel; ! ! public\ class\ HelloWorldFrame\ extends\ JFrame\ { ! ! \ \ \ String\ message\ =\ "Hello\ World!"; ! ! \ \ \ public\ HelloWorldFrame(){ ! \ \ \ \ \ \ \ \ setContentPane(new\ JPanel(){ ! \ \ \ \ \ \ \ \ \ \ \ \ \@Override ! \ \ \ \ \ \ \ \ \ \ \ \ protected\ void\ paintComponent(Graphics\ g)\ { ! \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ g.drawString(message,\ 15,\ 30); ! \ \ \ \ \ \ \ \ \ \ \ \ } ! \ \ \ \ \ \ \ \ }); ! \ \ \ \ \ \ \ \ setSize(100,\ 100); ! \ \ \ \ } ! \ \ \ \ public\ static\ void\ main(String[]\ args)\ { ! \ \ \ \ \ \ \ \ HelloWorldFrame\ frame\ =\ new\ HelloWorldFrame(); ! \ \ \ \ \ \ \ \ frame.setVisible(true); ! ! \ \ \ \ } + } + \f[R] .fi .PP ! The output from the \f[CB]javap\ HelloWorldFrame.class\f[R] command yields ! the following: ! .IP .nf ! \f[CB] ! Compiled\ from\ "HelloWorldFrame.java" ! public\ class\ HelloWorldFrame\ extends\ javax.swing.JFrame\ { ! \ \ java.lang.String\ message; ! \ \ public\ HelloWorldFrame(); ! \ \ public\ static\ void\ main(java.lang.String[]); ! } ! \f[R] .fi .PP ! The output from the \f[CB]javap\ \-c\ HelloWorldFrame.class\f[R] command ! yields the following: ! .IP .nf ! \f[CB] ! Compiled\ from\ "HelloWorldFrame.java" ! public\ class\ HelloWorldFrame\ extends\ javax.swing.JFrame\ { ! \ \ java.lang.String\ message; ! \ \ public\ HelloWorldFrame(); ! \ \ \ \ Code: ! \ \ \ \ \ \ \ 0:\ aload_0 ! \ \ \ \ \ \ \ 1:\ invokespecial\ #1\ \ \ \ \ \ \ \ //\ Method\ javax/swing/JFrame."<init>":()V ! \ \ \ \ \ \ \ 4:\ aload_0 ! \ \ \ \ \ \ \ 5:\ ldc\ \ \ \ \ \ \ \ \ \ \ #2\ \ \ \ \ \ \ \ //\ String\ Hello\ World! ! \ \ \ \ \ \ \ 7:\ putfield\ \ \ \ \ \ #3\ \ \ \ \ \ \ \ //\ Field\ message:Ljava/lang/String; ! \ \ \ \ \ \ 10:\ aload_0 ! \ \ \ \ \ \ 11:\ new\ \ \ \ \ \ \ \ \ \ \ #4\ \ \ \ \ \ \ \ //\ class\ HelloWorldFrame$1 ! \ \ \ \ \ \ 14:\ dup ! \ \ \ \ \ \ 15:\ aload_0 ! \ \ \ \ \ \ 16:\ invokespecial\ #5\ \ \ \ \ \ \ \ //\ Method\ HelloWorldFrame$1."<init>":(LHelloWorldFrame;)V ! \ \ \ \ \ \ 19:\ invokevirtual\ #6\ \ \ \ \ \ \ \ //\ Method\ setContentPane:(Ljava/awt/Container;)V ! \ \ \ \ \ \ 22:\ aload_0 ! \ \ \ \ \ \ 23:\ bipush\ \ \ \ \ \ \ \ 100 ! \ \ \ \ \ \ 25:\ bipush\ \ \ \ \ \ \ \ 100 ! \ \ \ \ \ \ 27:\ invokevirtual\ #7\ \ \ \ \ \ \ \ //\ Method\ setSize:(II)V ! \ \ \ \ \ \ 30:\ return + \ \ public\ static\ void\ main(java.lang.String[]); + \ \ \ \ Code: + \ \ \ \ \ \ \ 0:\ new\ \ \ \ \ \ \ \ \ \ \ #8\ \ \ \ \ \ \ \ //\ class\ HelloWorldFrame + \ \ \ \ \ \ \ 3:\ dup + \ \ \ \ \ \ \ 4:\ invokespecial\ #9\ \ \ \ \ \ \ \ //\ Method\ "<init>":()V + \ \ \ \ \ \ \ 7:\ astore_1 + \ \ \ \ \ \ \ 8:\ aload_1 + \ \ \ \ \ \ \ 9:\ iconst_1 + \ \ \ \ \ \ 10:\ invokevirtual\ #10\ \ \ \ \ \ \ //\ Method\ setVisible:(Z)V + \ \ \ \ \ \ 13:\ return + } + \f[R] .fi
< prev index next >