Troubleshooting Tools on Solaris OS and Linux for Java SE 6

Monitoring Tools
Debugging Tools
Scripting Tools


Monitoring Tools

Java VisualVM

Java¬ô VisualVM is a new monitoring and profiling tool for troubleshooting Java applications. It incorporates various technologies, including jvmstat and JMX, as well as CPU and memory profiling, to provide one easy-to-use integrated visualization tool. Developers can rapidly create their own extensions using a public API, and may share them with the community on a central repository.

  • Display local and remote Java applications.
  • Display application configuration and runtime environment.
  • Monitor application memory consumption and runtime behavior.
  • Monitor application threads.
  • Profile application performance or analyze memory allocation. (Local applications only.)
  • Create and display thread dumps.
  • Create and browse heap dumps.
  • Analyze core dumps.
  • Analyze applications offline.
  • Get additional plugins contributed by the community.
  • Write and share your own plugins.

JConsole

Launch a GUI to monitor and manage Java applications and Java VMs on a local or remote machine.

  • Connection to Java process, host, or JMX agent.
  • Graphical overview of CPU usage, heap memory, threads, classes.
  • Summary of key data, for example, uptime, compilation time, objects pending finalization, and more.
  • Memory statistics, including garbage collection.
  • Request garbage collection.
  • Thread statistics.
  • Deadlock detection.
  • Class statistics.
  • Tree structure of all platform and application MBeans.
  • Set the value of an MBean attribute.
  • Invoke operation on an MBean, for example, perform a heap dump.
  • Subscribe to notification for an MBean.
  • Information about the virtual machine, the compiler, the operating system.
  • Pass flags to VM on which JConsole is running.

jps

List instrumented Java virtual machines.

jstat

Display performance statistics for an instrumented Java VM:

  • Behavior of the class loader
  • Behavior of the HotSpot Just-in-Time compiler, totals and by method
  • Behavior of the GC heap
  • Behavior and sizes of the generation areas

jstatd

  • Monitor for creation and termination of instrumented HotSpot Java VMs.
  • Provide an interface for remote monitoring tools to attach to Java VMs.

Debugging Tools

HPROF profiler

Writes class profiling information to a file or a socket, in ASCII or binary.

  • Heap allocation profiling.
  • Heap dump.
  • CPU usage - for threads, methods.
  • Monitor contention profiling.

To invoke the HPROF tool: java -agentlib:hprof ToBeProfiledClass

To print the complete list of options: java -agentlib:hprof=help

jdb

Launch a simple interactive command-line debugger.

  • Display Java objects and primitive values.
  • List currently running threads.
  • Dump the current thread stack.
  • Set breakpoints.
  • Step through execution.
  • Examine exceptions.

jhat

Parse a binary heap dump, launch a web browser, and present standard queries.

  • Execute standard queries, for example, classes, objects, class instances, reference chains from object rootset, reachable objects, and more.
  • Turn on or off object allocation tracking.
  • Turn on or off object reference tracking.
  • Specify objects to exclude from "reachable objects" query.
  • Pass flags to the Java VM on which jhat is running.
  • Develop custom queries with buit-in Object Query Language.
  • Compare objects in two dumps.

jinfo

  • Print command line flags and system properties for a running process, from a core file, or for a remote debug server.
  • Dynamically set, unset, or change the value of certain Java VM flags for a process.

jmap

  • Print shared object mappings for a process, a core file, or a remote debug server.
  • Dump the Java heap (all objects or only live objects) of a process, a core file, or a remote debug server in binary format to a file.
  • Force the Java heap dump of a process if the process does not respond.
  • Print a heap summary for a process, a core file, or a remote debug server.
  • Print a histogram (all objects or only live objects) of a process, a core file, or a remote debug server.
  • Print information on objects awaiting finalization.
  • Print class loader statistics of the permanent generation.
  • Pass flags to the VM.

jsadebugd

Serviceability Agent Debug Daemon, which acts as debug server.

  • Attach to a Java process or a core file.
  • Remote clients can attach to the server using RMI.

jstack

  • Print stack traces of threads for a process, core file, or remote debug server
  • Print information about concurrent locks for a process, core file, or remote debug server
  • Force the stack dump for a process if the process does not respond

Scripting Tools

jrunscript

  • Command-line script shell: Evaluate or execute a script in interactive or batch mode.
  • Pass flag to the VM.
  • Set Java system properties.