Chapter 13. Platform Tools

This chapter discusses the tools that ship with the OpenJDK version of the Java platform. The tools covered are all command-line tools. If you are using a different version of Java, you may find different tools as part of your distribution but with similar function.

Later in the chapter, we devote dedicated sections to two tools: jshell, which introduced interactive development to the Java platform, and Java Flight Recorder (JFR) tooling for deep profiling of Java applications.

Command-Line Tools

The command-line tools we cover are the most commonly used tools and those of greatest utility—they are not a complete description of every available tool. In particular, tools concerned with CORBA and the server portion of RMI are not covered, as these modules were removed from the platform with the release of Java 11.

Note

In some cases, we need to discuss switches that take filesystem paths. As elsewhere in the book, we use Unix conventions for such cases.

Below we’ll discuss the following tools, including their basic usage, description, and common switches:

  • javac

  • java

  • jar

  • javadoc

  • jdeps

  • jps

  • jstat

  • jstatd

  • jinfo

  • jstack

  • jmap

  • javap

  • jlink

  • jmod

  • jcmd

Note

Options described throughout are targeted at Java 17 and may vary in older Java versions. For example, --class-path was introduced when --module-path became an option but won’t work on Java 8 and earlier (which require -cp or --classpath).

javac

Basic usage

bjavac some/package ...

Get Java in a Nutshell, 8th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.