Java Tools Tutorials - Herong's Tutorial Examples

http://www.herongyang.com/Java-Tools

Copyright © 2018 by Dr. Herong Yang. All rights reserved.

Java Tools Tutorials This tutorial book is based on notes and sample codes collected by the author while he was learning Java tools himself. Topics includes: 'java/javaw' Launcher, 'javac' Compiler, 'javap' Class File Disassembler, 'jar/jarsigner' Archive Tool, 'jconsole' Console, 'jdb' Debugger, 'jhat' Heap Analysis Tool, 'jlink' JRE Linker, 'jmap' Memory Dumper, 'jmc' Mission Control, 'jstack' Stack Dumper, 'jstat' Statistics, 'jstatd' Statistics Deamon 'jvisualvm' Visual VM, 'keytool' Keystore Tool.

Table of Contents

About This Book

Java Tools Terminology

Java Tools Included in JDK

Installing Latest JDK on Windows

Testing JDK Installation

Listing Java Tools in JDK

Adding JDK "bin" Direcotry to Path Setting

javac - The Java Program Compiler

javac - Java Compilation Command and Options

Compiling Hello.java - My First Java Program

"javac -classpath" - Specifying Class Path

"javac -verbose" - Printing Compilation Details

"javac -sourcepath" - Specifying Source Path

"javac -d" - Specifying Output Directory

Two Types of "import" Statements

"import" Statements Processed by "javac"

"javac -g" - Controlling Debugging Information

"javac --module" - Compiling Entire Module

"javac -X" - Specifying Non-Standard Options

jar - The JAR File Tool

JAR - Java Archive File Format

jar - JAR File Tool Command and Options

"jar --create" - Creating New JAR File

"jar --list" - Listing Files in JAR File

"jar --extract" - Extracting Files from JAR File

Managing JAR Files with WinZIP

META-INF/MANIFEST.MF - JAR Manifest File

Adding META-INF/MANIFEST.MF to JAR Files

"jar -C" - Changing Input Directory

Using JAR Files in Java Class Paths

"jar --update" - Updating Class Files in JAR

"jar --main-class" - Making JAR File Executable

Creating Module JAR File

"jar --module-version" - Updating Module Version in JAR

jlink - The JRE Linker

jmod - The JMOD File Tool

jimage - The JIMAGE File Tool

JIMAGE - Java Image File Format

jimage - JIMAGE File Tool Command

"jimage info|list" - Listing JIMAGE Entries

"jimage extract" - Extracting JIMAGE File Entries

Java File Types and Related Tools

java - The Java Program Launcher

java - Program Launching Command and Options

Launching Hello.java - My First Java Program

"java -classpath" - Specifying Class Path

"java -jar" - Specifying Executable JAR File

"java -X" - Specifying Non-Standard Options

"java --list-modules" - Listing Modules in JDK

"java --describe-module" - Printing Module Definition

"java --module" - Launching Program from Module

"java --module" - Launching Program from Module JAR

javaw - Launching Java Programs without Console

jdb - The Java Debugger

jcmd - The JVM Diagnostic Tool

jcmd - JVM Diagnostic Tool Command

"jcmd 0 help" - Listing JVM Diagnostic Commands

"jcmd 0 VM.*" - Running VM Diagnostic Commands

"jcmd 0 GC.*" - Running GC Diagnostic Commands

"jcmd 0 Thread.print" - Generating Thread Dump

jconsole - Java Monitoring and Management Console

JMX Technology and jconsole Tool

jconsole - Command Options and Connection Window

com.sun.management.jmxremote - JMX Agent for Local Connection

jconsole - Connecting to a Local JMX Agent

com.sun.management.jmxremote.port - JMX Agent for Remote Connection

jconsole - Connecting to a Remote JMX Agent

jstat - JVM Statistics Monitoring Tool

JVM Troubleshooting Tools

JVM Troubleshooting Tools in JDK

jinfo - VM Option Value Checker

jinfo - Changing HotSpot VM Option

jstack - Stack Tracer to Generate Thread Dump

What Is a Thread Dump?

Java Thread Deadlock Demo Program

jstack - Detecting Java Thread Deadlocks

jmap - JVM Heap Dump Tool

Printing Histogram of Java Object Heap

jmap - Generating Heap Dump File

jhat - Java Heap Analysis Tool

jhat - Starting Web Server on a Heap Dump File

Listing Instance Counts of All Classes

Browsing Object Instance Values

Object Query Language (OQL)

Searching for Instances with OQL Statements

jvisualvm (Java VisualVM) - JVM Visual Tool

jmc - Java Mission Control

jmc (Java Mission Control) - What Is It

Launching jmc (Java Mission Control)

jmc - JMX Console via MBean Server

MBean Browser on jmc JMX Console

Monitoring Trigers on jmc JMX Console

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

jarsigner - JAR File Signer

jshell - Java Language Shell

jshell - What Is It

jshell - Entering Expressions and Statements

"jshell> /save" - Saving Code Snippet

"jshell> /edit" - Editing Code Snippet

native2ascii - Native-to-ASCII Encoding Converter

native2ascii - Encoding Converter Command and Options

javac - Using CP1252 to Process Source File

"native2ascii -encoding" - UTF-8 to \udddd Conversion

Setting UTF-8 Encoding in PrintStream

Converting \udddd Sequences Back with "-reverse" Option

Outdated Tutorials

Outdated: Downloading and Installing Java 8

Outdated: Downloading and Installing J2SE 1.6.0 on Windows

Outdated: JDK 1.6 keytool - keystore File Tool

Outdated: Downloading and Installing J2SE 1.5.0 on Windows

Outdated: JDK 1.5 keytool - keystore File Tool

References

Full Version in PDF/EPUB

Keywords: Java, Tools, Compiler, Debugger, Monitor