Skip to content

Instantly share code, notes, and snippets.

@copley
Created May 5, 2020 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save copley/a273d942d0939558da0331c8d44e8f0f to your computer and use it in GitHub Desktop.
Save copley/a273d942d0939558da0331c8d44e8f0f to your computer and use it in GitHub Desktop.
1 Tools and Commands Reference
The JDK tools and their commands enable developers to handle development tasks such as compiling and running a program, packaging source files into a Java Archive (JAR) file, applying security policies to a JAR file, and more.
The tools and commands reference topic lists and describes the Java Development Kit (JDK) tools. They’re grouped into the following sections based on the related functions that they perform. Details about the tools and the commands that you use to run them are contained in the corresponding sections of this guide.
Main Tools
The following foundation tools and commands let you create and build applications:
javac: You can use the javac tool and its options to read Java class and interface definitions and compile them into bytecode and class files.
javap: You use the javap command to disassemble one or more class files.
javadoc: You use the javadoc tool and its options to generate HTML pages of API documentation from Java source files.
java: You can use the java command to launch a Java application.
appletviewer: You use the appletviewer command to launch the AppletViewer and run applets outside of a web browser.
jar: You can use the jar command to create an archive for classes and resources, and to manipulate or restore individual classes or resources from an archive.
jlink: You can use the jlink tool to assemble and optimize a set of modules and their dependencies into a custom runtime image.
jmod: You use the jmod tool to create JMOD files and list the content of existing JMOD files.
jdeps: You use the jdeps command to launch the Java class dependency analyzer.
jdeprscan: You use the jdeprscan tool as a static analysis tool that scans a jar file (or some other aggregation of class files) for uses of deprecated API elements.
Language Shell
The following tool gives you an interactive environment for trying out the Java language:
jshell: You use the jshell tool to interactively evaluate declarations, statements, and expressions of the Java programming language in a read-eval-print loop (REPL).
Security Tools
The following security tools set security policies on your system and create applications that can work within the scope of security policies set at remote sites:
keytool: You use the keytool command and options to manage a keystore (database) of cryptographic keys, X.509 certificate chains, and trusted certificates.
jarsigner: You use the jarsigner tool to sign and verify Java Archive (JAR) files.
The following tools obtain, list, and manage Kerberos tickets on Windows:
kinit: You use the kinit tool and its options to obtain and cache Kerberos ticket-granting tickets.
klist: You use the klist tool to display the entries in the local credentials cache and key table.
ktab: You use the ktab tool to manage the principal names and service keys stored in a local key table.
Remote Method Invocation (RMI) Tools
The following tools enable creating applications that interact over the Web or other network:
rmic: You use the rmic compiler to generate stub and skeleton class files using the Java Remote Method Protocol (JRMP) and stub and tie class files (IIOP protocol) for remote objects.
rmiregistry: You use the rmiregistry command to create and start a remote object registry on the specified port on the current host.
rmid: You use the rmid command to start the activation system daemon that enables objects to be registered and activated in a Java Virtual Machine (JVM).
serialver: You use the serialver command to return the serialVersionUID for one or more classes in a form suitable for copying into an evolving class.
Java IDL and RMI-IIOP Tools
The following tools enable creating applications that use OMG-standard IDL and CORBA/IIOP:
tnameserv: You use the tnameserv command as a substitute for Object Request Broker Daemon (ORBD).
idlj: You use the idlj command to generate Java bindings for a specified Interface Definition Language (IDL) file.
orbd: You use the orbd command for the client to transparently locate and call persistent objects on servers in the CORBA environment.
servertool: You use the servertool command-line tool to register, unregister, start up, and shut down a persistent server.
Java Deployment Tools
The following utilities let you deploy Java applications and applets on the web:
pack200: You use the pack200 command to transform a Java Archive (JAR) file into a compressed pack200 file with the Java gzip compressor.
unpack200: You use the unpack200 command to transform a packed file into a JAR file for web deployment.
javapackager: You use the javapackager command to perform tasks related to packaging Java and JavaFX applications.
Java Web Start
The following utility launches Java Web Start applications:
javaws: You use the javaws tool command and its options to start Java Web Start.
Monitoring Tools
The following tools let you monitor performance statistics:
jconsole: You use the jconsole command to start a graphical console to monitor and manage Java applications.
jmc: You use the jmc command and its options to launch Java Mission Control. Java Mission Control is a profiling, monitoring, and diagnostics tools suite.
Note:
The following experimental tools are unsupported and should be used with that understanding. They may not be available in future JDK versions.
jps: Experimental You use the jps command to list the instrumented JVMs on the target system.
jstat: Experimental You use the jstat command to monitor JVM statistics. This command is experimental and unsupported.
jstatd: Experimental You use the jstatd command to monitor the creation and termination of instrumented Java HotSpot VMs. This command is experimental and unsupported.
Java Web Services Tools
The following tools let you create applications that provide web services:
schemagen: You can use the schemagen tool and commands to generate a schema for every namespace that’s referenced in your Java classes.
wsgen: You use the wsgen command to generate Java API for XML Web Services (JAX-WS) portable artifacts used in JAX-WS web services.
wsimport: You use the wsimport command to generate Java API for XML Web Services (JAX-WS) portable artifacts.
xjc: You use the xjc shell script to compile an XML schema file into fully annotated Java classes.
Java Accessibility Utilities
The following utilities let you check the accessibility of Java objects:
jaccessinspector: You use the jaccessinspector accessibility evaluation tool for the Java Accessibility Utilities API to examine accessible information about the objects in the Java Virtual Machine.
jaccesswalker: You use the jaccesswalker to navigate through the component trees in a particular Java Virtual Machine and presents the hierarchy in a tree view.
Troubleshooting Tools
The following tools let you perform specific troubleshooting tasks:
jcmd: You use the jcmd utility to send diagnostic command requests to a running Java Virtual Machine (JVM).
jdb: You use the jdb command and its options to find and fix bugs in Java platform programs.
jhsdb: You use the jhsdb tool to attach to a Java process or to launch a postmortem debugger to analyze the content of a core dump from a crashed Java Virtual Machine (JVM).
Note:
The following experimental tools are unsupported and should be used with that understanding. They may not be available in future JDK versions. Some of these tools aren’t currently available on Windows platforms.
jinfo: Experimental You use the jinfo command to generate Java configuration information for a specified Java process. This command is experimental and unsupported.
jmap: Experimental You use the jmap command to print details of a specified process. This command is experimental and unsupported.
jstack: Experimental You use the jstack command to print Java stack traces of Java threads for a specified Java process. This command is experimental and unsupported.
Scripting Tools
The following tools let you run scripts that interact with the Java platform:
jjs: You use the jjs command-line tool to invoke the Nashorn engine.
Note:
The following experimental tool is unsupported and should be used with that understanding. It may not be available in future JDK versions.
jrunscript: Experimental You use the jrunscript command to run a command-line script shell that supports interactive and batch modes.
General Information
The following documents contain important information you will need to know to get the most out of the JDK tools.
Document Type Platform
JDK File Structure [Solaris] [Linux] [Windows]
Setting the Classpath [Solaris and Linux] [Windows]
How Classes are Found [Solaris, Linux and Windows]
Enhancements
The man page for each tool reflects the latest behavior for that tool, but the following page details the tools changes specific to a release.
Enhancements in JDK 7
Basic Tools
These tools are the foundation of the JDK. They are the tools you use to create and build applications.
Tool Name Brief Description Links to Reference Pages
appletviewer Run and debug applets without a web browser. [Solaris and Linux] [Windows]
apt Annotation processing tool.
See Annotation Processing Tool for program annotation processing. [Solaris, Linux, and Windows]
extcheck Utility to detect Jar conflicts. [Solaris and Linux] [Windows]
jar Create and manage Java Archive (JAR) files.
See Java Archive Files page for the JAR specification. [Solaris and Linux] [Windows]
java The launcher for Java applications. In this release, a single launcher is used both for development and deployment.
The old deployment launcher, jre, is no longer provided. [Solaris and Linux] [Windows]
javac The compiler for the Java programming language. [Solaris and Linux] [Windows]
javadoc API documentation generator.
See Javadoc Tool page for doclet and taglet APIs. [Solaris and Linux] [Windows]
javah C header and stub generator. Used to write native methods. [Solaris and Linux] [Windows]
javap Class file disassembler [Solaris and Linux] [Windows]
jdb The Java Debugger.
See JPDA for the debugger architecture specifications. [Solaris and Linux] [Windows]
Security Tools
These security tools help you set security policies on your system and create applications that can work within the scope of security policies set at remote sites.
Tool Name Brief Description Links to Reference Pages
keytool Manage keystores and certificates. [Solaris and Linux] [Windows]
jarsigner Generate and verify JAR signatures. [Solaris and Linux] [Windows]
policytool GUI tool for managing policy files. [Solaris and Linux] [Windows]
These security tools help you obtain, list, and manage Kerberos tickets.
Tool Name Brief Description Links to Reference Pages
kinit Tool for obtaining Kerberos v5 tickets. Equivalent functionality is available on the Solaris operating system via the kinit tool. For example, for Solaris 11, see the kinit reference page. [Windows]
klist Command-line tool to list entries in credential cache and key tab. Equivalent functionality is available on the Solaris operating system via the klist tool. For example, for Solaris 11, see the klist reference page. [Windows]
ktab Command-line tool to help the user manage entries in the key table. Equivalent functionality is available on the Solaris operating system via the kadmin tool. For example, for Solaris 11, see the kadmin reference page. [Windows]
Internationalization Tools
This tool helps to create localizable applications.
Tool Name Brief Description Links to Reference Pages
native2ascii Convert text to Unicode Latin-1. [Solaris and Linux] [Windows]
Remote Method Invocation (RMI) Tools
These tools help to create applications that interact over the Web or other network.
Tool Name Brief Description Links to Reference Pages
rmic Generate stubs and skeletons for remote objects. [Solaris and Linux] [Windows]
rmiregistry Remote object registry service. [Solaris and Linux] [Windows]
rmid RMI activation system daemon. [Solaris and Linux] [Windows]
serialver Return class serialVersionUID. [Solaris and Linux] [Windows]
Java IDL and RMI-IIOP Tools
These tools are used when creating applications that use OMG-standard IDL and CORBA/IIOP.
Tool Name Brief Description
tnameserv Provides access to the naming service.
idlj Generates .java files that map an OMG IDL interface and enable an application written in the Java programming language to use CORBA functionality.
orbd Provides support for clients to transparently locate and invoke persistent objects on servers in the CORBA environment. ORBD is used instead of the Transient Naming Service, tnameserv. ORBD includes both a Transient Naming Service and a Persistent Naming Service. The orbd tool incorporates the functionality of a Server Manager, an Interoperable Naming Service, and a Bootstrap Name Server. When used in conjunction with the servertool, the Server Manager locates, registers, and activates a server when a client wants to access the server.
servertool Provides ease-of-use interface for the application programmers to register, unregister, startup, and shutdown a server.
Java Deployment Tools
Utilities for use in conjunction with deployment of java applications and applets on the web.
Tool Name Brief Description
javafxpackager Packages JavaFX applications for deployment. See Deploying JavaFX Applications for more information.
pack200 Transforms a JAR file into a compressed pack200 file using the Java gzip compressor. The compressed packed files are highly compressed JARs, which can be directly deployed, saving bandwidth and reducing download time.
unpack200 Transforms a packed file produced by pack200 into a JAR file.
Java Web Start Tools
Utilities for use in conjunction with Java Web Start.
Tool Name Brief Description
javaws Command line tool for launching Java Web Start and setting various options.
See Java Web Start Guide for more information.
Java Troubleshooting, Profiling, Monitoring and Management Tools
Tool Name Brief Description
jcmd JVM Diagnostic Commands tool - sends diagnostic command requests to a running Java Virtual Machine. [Solaris and Linux] [Windows]
jconsole A JMX-compliant graphical tool for monitoring a Java virtual machine. It can monitor both local and remote JVMs. It can also monitor and manage an application.
See Monitoring and Management for the Java Platform for more information.
jmc The Java Mission Control (JMC) client includes tools to monitor and manage your Java application without introducing the performance overhead normally associated with these types of tools. [Solaris and Linux] [Windows]
jvisualvm A graphical tool that provides detailed information about the Java technology-based applications (Java applications) while they are running in a Java Virtual Machine. Java VisualVM provides memory and CPU profiling, heap dump analysis, memory leak detection, access to MBeans, and garbage collection. See Java VisualVM for more information.
Java Web Services Tools
Tool Name Brief Description
schemagen Schema generator for Java Architecture for XML Binding.
wsgen Tool to generate JAX-WS portable artifacts.
wsimport Tool to generate JAX-WS portable artifacts.
xjc Binding compiler for Java Architecture for XML Binding.
Monitoring Tools
You can use the following tools to monitor JVM performance statistics. The tools described in this section are unsupported and experimental, and should be used with that in mind. They may not be available in future JDK versions.
These tools are supported on all platforms except Windows 98 and Windows ME.
Tool Name Brief Description
jps Experimental: JVM Process Status Tool - Lists instrumented HotSpot Java virtual machines on a target system.
jstat Experimental: JVM Statistics Monitoring Tool - Attaches to an instrumented HotSpot Java virtual machine and collects and logs performance statistics as specified by the command line options.
jstatd Experimental: JVM jstat Daemon - Launches an RMI server application that monitors for the creation and termination of instrumented HotSpot Java virtual machines and provides a interface to allow remote monitoring tools to attach to Java virtual machines running on the local system.
Troubleshooting Tools
The following tools can be used for specific troubleshooting tasks. The tools described in this section are unsupported and experimental in nature and should be used with that in mind. They may not be available in future JDK versions.
Some of these tools are not currently available on Windows platforms.
Tool Name Brief Description
jinfo Experimental - Configuration Info for Java - Prints configuration information for a given process or core file or a remote debug server.
jhat Experimental - Heap Dump Browser - Starts a web server on a heap dump file (for example, produced by jmap -dump), allowing the heap to be browsed.
jmap Experimental - Memory Map for Java - Prints shared object memory maps or heap memory details of a given process or core file or a remote debug server.
jsadebugd Experimental - Serviceability Agent Debug Daemon for Java - Attaches to a process or core file and acts as a debug server.
jstack Experimental - Stack Trace for Java - Prints a stack trace of threads for a given process or core file or remote debug server.
Refer to the Java™ SE Troubleshooting web site for descriptions of tools, options, and other information to use in analyzing problems. The documents at this site contain suggestions about what to try before submitting a bug report and what data to collect for a report.
Scripting Tools
The following tool can be used to run scripts that interact with the Java platform. This tool is unsupported and experimental in nature and should be used with that in mind. It might not be available in future JDK versions.
Tool Name Brief Description
jrunscript Experimental - Script shell for Java - Runs a script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment