Java Tools Tutorials - Herong's Tutorial Examples - v6.23, by Herong Yang
Looking Up Method Signature with javap Command
This section provides a tutorial example of how to lookup method signatures in a class file or JAR file with the 'javap' command.
"javap" can also be used as a handy tool to look up method signatures while you are writing Java programs.
For example, if you are coding a Java program, and you need to convert a byte array into a character string, but you don't remember which method in the String class to use, and how many arguments are needed for that method. If you are using a good Java IDE, it will help you with a list of public methods and their signatures.
But what can you do, if you are using a simple text editor, not a smart Java IDE? You can use the "javap" command as a handy tool to look up method signatures. The following tutorial example shows you how to find the method to convert a byte array into a character string:
herong> javap java.lang.String | find "byte" static final byte LATIN1; static final byte UTF16; public java.lang.String(byte[], int, int, int); public java.lang.String(byte[], int); public java.lang.String(byte[], int, int, java.lang.String) throws java.io.UnsupportedEncodingException; public java.lang.String(byte[], java.lang.String) throws java.io.UnsupportedEncodingException; public java.lang.String(byte[], int, int); public java.lang.String(byte[]); public void getBytes(int, int, byte[], int); public byte[] getBytes(java.lang.String) throws java.io.UnsupportedEncodingException; public byte[] getBytes(); ...
What can you learn from this tutorial example:
Table of Contents
javac - The Java Program Compiler
java - The Java Program Launcher
jpackage - Binary Package Builder
javadoc - The Java Document Generator
jdeps - The Java Class Dependency Analyzer
jdeprscan - The Java Deprecated API Scanner
jcmd - The JVM Diagnostic Tool
jconsole - Java Monitoring and Management Console
jstat - JVM Statistics Monitoring Tool
jhsdb - The Java HotSpot Debugger
jvisualvm (Java VisualVM) - JVM Visual Tool
►javap - The Java Class File Disassembler
javap - Java Disassembler Command and Options
javap - Listing Public Variables and Methods
"javap -private" - Listing Private Variables and Methods
"javap -c -private" - Disassembling Java Bytecode Class
►Looking Up Method Signature with javap Command
keytool - Public Key Certificate Tool
jrunscript - Script Code Shell
native2ascii - Native-to-ASCII Encoding Converter