Java Tools Tutorials - Herong's Tutorial Notes - Version 5.30, by Dr. Herong Yang

Java Tools Tutorials - Herong's Tutorial Notes

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

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

HerongYang.com This free book is an excellent tutorial book for beginners. It is a collection of notes and sample codes written by the author while he was learning Java tools himself. Topics include java, javac, jar, jdb, jar, javap, keytool, jconsole, jps, jstatd, jstat, jinfo, jmap, jhat, jstack.

Table of Contents

About This Book

Java Tools Terminology

Installing Java 8 on Windows

Downloading and Installing Java 8 on Windows

Testing Java 8 Installation

'javac' - The Java Program Compiler

'javac' - Java Compilation Command and Options

Compiling Hello.java - My First Java Program

Option '-classpath' - Specifying Class Path

Option '-sourcepath' - Specifying Source Path

Option '-d' - Specifying Output Directory

Two Types of 'import' Statements

'import' Statements Processed by 'javac'

Option "-g" - Controlling Debugging Information

'java' - The Java Program Launcher

'java' - Java Launching Command and Options

Launching Hello.java - My First Java Program

Option "-classpath" - Specifying Class Path

Option '-jar' - Specifying Executable JAR Files

Option '-X' - Specifying Non-Standard Options

'javaw' - Launching Java Programs without Console

'jdb' - The Java Debugger

'jdb' - Java Debugger Command and Options

Starting a Debugging Session with 'jdb'

Debugging Applications with Separate 'jdb' Sessions

Debugging Java Applications Remotely

Listing Debugging Commands with 'help' Command

PrimeNumberSeeker.java - Multi-Thread Sample Program

Starting Debugging Session on a Multi-Thread Application

Stepping through Statements of a Child Thread

Checking Variable Values in a Debugging Session

Debugging the Main Thread of a Multi-Thread Application

Switching Execution Threads in a Debugging Session

Suspending Main Thread to Debug Child Thread

'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

'jps' - JVM Process Status Tool

Listing JVM Processes on the Local Machine with "jps"

'jstatd' - JVM Remote Monitoring Server

Starting 'jstatd' with a Security Policy File

Connecting to 'jps' to Remote 'jstatd'

'jstat' Command Options and Parameters

Garbage Collection Testing Program

'jstat -gcutil' - Garbage Collection Statistics

Accessing Remote JVM Processes with 'jstat'

JVM Troubleshooting Tools

JVM Troubleshooting Tools in JDK 1.5

'jinfo' - VM Option Value Checker

Changing HotSpot VM Option using 'jinfo'

'jstack' - Stack Tracer of JVM Threads

Java Thread Deadlock Demo Program

Detecting Java Thread Deadlocks with 'jstack'

'jmap' - JVM Heap Dump Tool

Printing Histogram of Java Object Heap

Generating Heap Dump File with 'jmap'

'jhat' - Java Heap Analysis Tool

Starting 'jhat' 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

What Is jvisualvm (Java VisualVM)?

jvisualvm Command to Open Dump Files or Conections

Connecting Java VisualVM to a Local JVM Process

Monitoring Usgaes of CPU, Heap, Classes and Threads

Monitoring Thread Status as Timeline

Taking Thread Dump to See Thread Stack Traces

Taking Heap Dump to See Memory Usages

Viewing a Heap Dump File

Connecting to Remote JVM Processes

Avaible Plugins and Installation

Installing Visual GC Plugin

'jar' - The JAR File Tool

JAR - Java Archive File Format

'jar' - JAR File Tool Command and Options

Creating the First JAR File - hello.jar

Managing JAR Files with WinZIP

META-INF/MANIFEST.MF - JAR Manifest File

Adding META-INF/MANIFEST.MF to JAR Files

Using JAR Files in Java Class Paths

Creating Executable JAR Files

'javap' - The Java Class File Disassembler

'javap' - Java Disassembler Command and Options

Listing Public Variables and Methods with 'javap'

Listing Private Variables and Methods with 'javap -private'

Disassembling Java Bytecode Class Files with 'javap -c -private'

Looking Up Method Signature with 'javap' Command

'keytool' - Public Key Certificate Tool

Certificates and Certificate Chains

'keystore' - Public Key Certificate Storage File

JDK 1.5 'keytool' - keystore File Management Commands

JDK 1.6 'keytool' - keystore File Management Commands

Generating Key Pairs and Self-Signed Certificates

Exporting and Import Certificates

Cloning Certificates with New Identities

'native2ascii' - Native-to-ASCII Encoding Converter

'native2ascii' - Encoding Converter Command and Options

'javac' Using CP1252 to Process Source File

UTF-8 to \udddd Conversion with 'native2ascii -encoding'

Setting UTF-8 Encoding in PrintStream

Converting \udddd Sequences Back with "-reverse" Option

Outdated Tutorials

Outdated: Downloading and Installing J2SE 1.6.0 on Windows

Outdated: Downloading and Installing J2SE 1.5.0 on Windows

References

PDF Printing Version

Keywords: java, javac, jar, jdb, jconsole, jstack, jmap, jar, javap, keytool

Table of Contents - Updated in 2014, by Dr. Herong Yang