JAVAP(1)

πŸ“¦ version 17.0.19.0, in opensuse-leap 16.0

✨ JAVAP(1) ✨

okay so bestie, welcome to the javap page πŸ’… this is the JDK command that literally disassembles your class files and shows you what's inside, no cap. let's get into it 🫢


🌸 NAME 🌸

javap β€” disassemble one or more class files. that's it, that's the vibe. πŸ”₯


πŸ¦‹ SYNOPSIS πŸ¦‹

javap [options] classes...
  • options β€” the command-line options, bestie. see the Options section for javap below πŸ‘‡
  • classes β€” 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. so many options, we love to see it πŸ’–

Examples, because i know you wanna see them:

path/to/MyClass.class

jar:file:///path/to/MyJar.jar!/mypkg/MyClass.class

java.lang.Object

πŸŽ€ DESCRIPTION πŸŽ€

The javap command disassembles one or more class files, periodt. the output depends on the options used. when no options are used, javap prints the protected and public fields, and methods of the classes passed to it. so it's giving just the highlights energy by default ✨

okay important thing: the javap command isn'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. iykyk πŸ™ˆ

The javap command prints its output to stdout.

Note: in tools that support -- style options, the GNU-style options can use the equal sign (=) instead of a white space to separate the name of an option from its value. slay ✨

πŸ’œ OPTIONS FOR JAVAP πŸ’œ

okay bestie, here's the whole menu, no skipping, we're doing all of them πŸ“

  • --help, -help, -h, or -? β€” prints a help message for the javap command. your little safety net 🫢
  • -version β€” prints release information. know your era πŸ’…
  • -verbose or -v β€” prints additional information about the selected class. the way that extra detail just hits πŸ‘‘
  • -l β€” prints line and local variable tables. receipts, basically 🧾
  • -public β€” shows only public classes and members. main character energy only ✨
  • -protected β€” shows only protected and public classes and members. a slightly bigger circle πŸ¦‹
  • -package β€” shows package/protected/public classes and members (default). this is the default, so it's literally the baseline vibe 🌸
  • -private or -p β€” shows all classes and members. no secrets, we're all friends here πŸ’€
  • -c β€” prints disassembled code, for example, the instructions that comprise the Java bytecodes, for each of the methods in the class. this is the real tea β˜•πŸ”₯
  • -s β€” prints internal type signatures. lowkey iconic detail 🌈
  • -sysinfo β€” shows system information (path, size, date, SHA-256 hash) of the class being processed. full dossier energy πŸ•΅οΈβ€β™€οΈ
  • -constants β€” shows static final constants. the unchangeable faves ⭐
  • --module module or -m module β€” specifies the module containing classes to be disassembled.
  • --module-path path β€” specifies where to find application modules.
  • --system jdk β€” specifies where to find system modules.
  • --class-path path, -classpath path, or -cp path β€” specifies the path that the javap command uses to find user class files. it overrides the default or the CLASSPATH environment variable when it's set. so it's giving i'm in charge now πŸ’…
  • -bootclasspath path β€” overrides the location of bootstrap class files.
  • --multi-release version β€” specifies the version to select in multi-release JAR files.
  • -Joption β€” passes the specified option to the JVM. for example:
javap -J-version

javap -J-Djava.security.manager -J-Djava.security.policy=MyPolicy MyClassName

see Overview of Java Options in java. 🫢


🧚 JAVAP EXAMPLE 🧚

compile the following HelloWorldFrame class:

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);

    }

}

the output from the javap HelloWorldFrame.class command yields the following:

Compiled from "HelloWorldFrame.java"
public class HelloWorldFrame extends javax.swing.JFrame {
  java.lang.String message;
  public HelloWorldFrame();
  public static void main(java.lang.String[]);
}

the output from the javap -c HelloWorldFrame.class command yields the following:

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
}

and that's the whole page bestie πŸ’– this is JDK 17, dated 2021, and it's literally iconic. go disassemble something and slay βœ¨πŸ‘‘

πŸ“¦ where this page comes from
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms