Linux command
javap 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show public method signatures of a class
javap [ClassName]
Disassemble bytecode instructions
javap -c [ClassName]
Show all members including private
javap -p [ClassName]
Verbose output with stack size, locals, and constant pool
javap -v [ClassName]
Disassemble a class from a JAR file
javap -cp [lib.jar] [com.example.ClassName]
Show line number and local variable tables
javap -l [ClassName]
Show internal type signatures
javap -s [ClassName]
说明
javap is the Java class file disassembler included in the JDK. It examines compiled .class files and displays information about their fields, methods, and optionally the bytecode instructions that comprise each method. The tool is useful for understanding compiled Java code, debugging compilation issues, verifying method signatures, and inspecting bytecode without needing original source code.
参数
- -c
- Disassemble bytecode instructions for each method.
- -p, -private
- Show all classes and members including private.
- -protected
- Show only protected and public classes and members.
- -public
- Show only public classes and members.
- -package
- Show package, protected, and public classes and members (default).
- -v, -verbose
- Print stack size, number of locals, method arguments, and constant pool.
- -l
- Print line number and local variable tables.
- -s
- Print internal type signatures.
- -sysinfo
- Show system information (path, size, date, MD5 hash) of the class.
- -cp _PATH_, -classpath _PATH_
- Classpath for locating classes. Overrides CLASSPATH environment variable.
- -bootclasspath _PATH_
- Path from which to load bootstrap classes.
- -J _FLAG_
- Pass a flag directly to the Java runtime system.
- --help
- Display help information.
FAQ
What is the javap command used for?
javap is the Java class file disassembler included in the JDK. It examines compiled .class files and displays information about their fields, methods, and optionally the bytecode instructions that comprise each method. The tool is useful for understanding compiled Java code, debugging compilation issues, verifying method signatures, and inspecting bytecode without needing original source code.
How do I run a basic javap example?
Run `javap [ClassName]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c do in javap?
Disassemble bytecode instructions for each method.