Java Tools Tutorials - Herong's Tutorial Examples
By Herong Yang
()
About this ebook
Read more from Herong Yang
WSDL Tutorials - Herong's Tutorial Examples Rating: 0 out of 5 stars0 ratingsSOAP Web Service Tutorials - Herong's Tutorial Examples Rating: 0 out of 5 stars0 ratings
Related to Java Tools Tutorials - Herong's Tutorial Examples
Programming For You
Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Programming Arduino: Getting Started with Sketches Rating: 4 out of 5 stars4/5C Programming for Beginners: Your Guide to Easily Learn C Programming In 7 Days Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsPython Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsLearn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Pokemon Go: Guide + 20 Tips and Tricks You Must Read Hints, Tricks, Tips, Secrets, Android, iOS Rating: 5 out of 5 stars5/5Mastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5HTML5 For Dummies Quick Reference Rating: 4 out of 5 stars4/5
Reviews for Java Tools Tutorials - Herong's Tutorial Examples
0 ratings0 reviews
Book preview
Java Tools Tutorials - Herong's Tutorial Examples - Herong Yang
Java Tools Tutorials
- Herong's Tutorial Examples
Iconv6.24, 2024
Herong Yang
Copyright © 2005-2024 Herong Yang. All rights reserved.
ISBN: 978-0-359-43759-7
This tutorial book based on notes and sample codes collected by the author while he was learning Java tools himself. Topics includes: 'java/javaw' Launcher, 'javac' Compiler, 'javadoc' Document Generator, 'javap' Class File Disassembler, 'jar/jarsigner' Archive Tool, 'jconsole' Console, 'jdb' Debugger, 'jdeps' Dependency Analyzer, 'jdeprscan' Deprecated API Scanner, 'jhat' Heap Analysis Tool, 'jlink' JRE Linker, 'jhsdb' HotSpot Debugger, 'jmap' Memory Dumper, 'jmc' Mission Control, 'jpackage' Binary Package Builder, 'jrunscript' Script Shell, 'jstack' Stack Dumper, 'jstat' Statistics, 'jstatd' Statistics Daemon, 'jvisualvm' Visual VM, 'jwebserver' Web Server, 'keytool' Keystore Tool, 'serialver' serialVersionUID generator. Updated in 2024 (Version v6.24) with minor updates.
Table of Contents
About This Book
Java Tools Terminology
Java Tools Included in JDK
Installing Latest JDK on macOS
Installing Latest JDK on Windows
Adding JDK bin
Direcotry to Path Setting
Testing JDK Installation
Listing Java Tools in JDK
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
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
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
jlink - What Is It
jlink --add-modules java.base
- Build Base JRE
Running Java Programs with New JRE
Building Application Modules into New JRE
jlink --launcher
- Generating Launching Scripts
jmod - The JMOD File Tool
JMOD - Java Module File Format
jmod - JMOD File Tool Command
jmod create --class-path
- Create New JMOD File
jmod describe/list
- Get Info from JMOD File
Creating JMOD File from JAR Files
jmod create --cmds|config|libs...
- Packaging Other Files
jmod extract --dir
- Extracting Files
javac --add-modules
- Compiling with Supporting JMOD Files
jlink --add-modules
- Building JRE from JMOD Files
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
jpackage - Binary Package Builder
jpackage - What Is It
jpackage -t dmg
- Package for macOS
jpackage -t pkg
- Package for macOS
jpackage -t msi
- Package for Windows
javadoc - The Java Document Generator
javadoc - Document Generator Command and Options
Hello.java API Document
HelloDocumented.java - javadoc-Style Comments
Generate API Document for Java Package
jdeps - The Java Class Dependency Analyzer
jdeps - Class Dependency Analyzer Command
jdeps class_file
- Dependencies of Class File
jdeps -verbose
- Class Level Dependencies of Class File
jdeps jar_file
- Dependencies of JAR File
jdeps --inverse --require ...
- Reverse Dependencies
jdeprscan - The Java Deprecated API Scanner
jdeprscan - Deprecated API Scanner Command
jdeprscan jar_file
- Deprecated API of Class File
jdeprscan jar_file
- Deprecated API of JAR File
jdeprscan --release X
- Deprecated API as of Release X
jdeprscan --list
- List All Deprecated APIs
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
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
jps - JVM Process Status Tool
jps - Listing JVM Processes on the Local Machine
jstatd - JVM Remote Monitoring Server
Starting jstatd with a Security Policy File
Connecting jps to Remote jstatd
jstat - Command Options and Parameters
Garbage Collection Testing Program
jstat -gcutil
- Garbage Collection Statistics
jstat - Accessing Remote JVM Processes
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
jhsdb - The Java HotSpot Debugger
jhsdb - HotSpot Debugger Command
jhsdb hsdb
- HotSpot Debugger in GUI Mode
jhsdb hsdb
- Inspecting main
Thread
jhsdb hsdb
- Viewing Stack Memory Map
jhsdb clhsdb
- HotSpot Debugger in Command Line
jvisualvm (Java VisualVM) - JVM Visual Tool
What Is jvisualvm (Java VisualVM)?
jvisualvm Command to Open Dump Files or Connections
Connecting Java VisualVM to a Local JVM Process
Monitoring Usages 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
Available Plugins and Installation
Installing Visual GC Plugin
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
Certificates and Certificate Chains
keystore - Public Key Certificate Storage File
keytool - keystore File Management Commands
Generating Key Pairs and Self-Signed Certificates
Exporting and Import Certificates
Cloning Certificates with New Identities
keytool -importkeystore
- Converting Keystore Type
jarsigner - JAR File Signer
jarsigner - What Is It
What Is Digital Signature
keytool -genkeypair
- Self-Signed Certificate
jarsigner - Signing JAR File
jarsigner -verify
- Verifying Signed JAR
jarsigner -verify -keystore ...
- Trusted Certificate
jarsigner -verify -verbose -certs
- Signature Details
*.SF/*.DSA - Signature Files in Signed JAR
jshell - Java Language Shell
jshell - What Is It
jshell - Entering Expressions and Statements
jshell> /save
- Saving Code Snippet
jshell> /edit
- Editing Code Snippet
jrunscript - Script Code Shell
jrunscript - What Is It
jrunscript
- Run JavaScript Interactively
jrunscript -f
- Run JavaScript in Batch Mode
Miscellaneous Tools
serialver - serialVersionUID Generator
jaotc - Java Ahead-Of-Time Compiler
jwebserver - Java Web Server
native2ascii - Native-to-ASCII Encoding Converter
native2ascii - Encoding Converter Command and Options
javac - Using CP1252 to Process Source File
native2ascii -encoding
- UTF-8 to uXXXX Conversion
Setting UTF-8 Encoding in PrintStream
Converting uXXXX Sequences Back with -reverse
Option
JAB (Java Access Bridge) for Windows
What Is JAB (Java Access Bridge)
Java GUI Test Program
jaccesswalker
- GUI Component Tree Browser
jaccessinspector
- Accessible Information Examiner
Archived Tutorials
Installing JDK 15 on macOS
Archived: Installing JDK 12 on Windows
Archived: Installing JDK 10 on Windows
Archived: Downloading and Installing Java 8
Archived: Downloading and Installing J2SE 1.6.0 on Windows
Archived: JDK 1.6 keytool - keystore File Tool
Archived: Downloading and Installing J2SE 1.5.0 on Windows
Archived: JDK 1.5 keytool - keystore File Tool
References
Keywords: Java, Tools, Compiler, Debugger, Monitor
Java Tools Tutorials - Herong's Tutorial Examples
∟ About This Book
This section provides some detailed information about this book - Java Tools Tutorials - Herong's Tutorial Examples.
Title: Java Tools Tutorials - Herong's Tutorial Examples
Author: Herong Yang - Contact by email via herong_yang@yahoo.com.
Category: Programming
Version/Edition: v6.24, 2024
Number of pages in PDF format: 376
Description: This tutorial book based on notes and sample codes collected by the author while he was learning Java tools himself. Topics includes: 'java/javaw' Launcher, 'javac' Compiler, 'javadoc' Document Generator, 'javap' Class File Disassembler, 'jar/jarsigner' Archive Tool, 'jconsole' Console, 'jdb' Debugger, 'jdeps' Dependency Analyzer, 'jdeprscan' Deprecated API Scanner, 'jhat' Heap Analysis Tool, 'jlink' JRE Linker, 'jhsdb' HotSpot Debugger, 'jmap' Memory Dumper, 'jmc' Mission Control, 'jpackage' Binary Package Builder, 'jrunscript' Script Shell, 'jstack' Stack Dumper, 'jstat' Statistics, 'jstatd' Statistics Daemon, 'jvisualvm' Visual VM, 'jwebserver' Web Server, 'keytool' Keystore Tool, 'serialver' serialVersionUID generator. Updated in 2024 (Version v6.24) with minor updates.
Keywords: java, javac, javaw, jar, jarsigner, javap, jconsole, jdb, jdeps, jdeprscan, jhsdb, jhat, jlink, jmap, jmc, jps, jshell, jstack, jstat, jstatd, jvisualvm, keytool, native2ascii.
Copyright:
This book is under Copyright © 2005-2024 Herong Yang. All rights reserved.
Material in this book may not be published, broadcasted, rewritten or redistributed in any form.
The example codes is provided as-is, with no warranty of any kind.
Revision history:
Version v6.24, 2024. Minor updates.
Version v6.23, 2023. Updated with JDK 20.
Version v6.22, 2022. Updated with JDK 17.
Version v6.10, 2018. Added more tutorials on jmod and jlink.
Version v6.00, 2018. Updated with JDK 10.
Version v5.00, 2014. Updated with JDK 8.
Version v1.00, 2005. First release.
Web version: https://www.herongyang.com/Java-Tools - Provides free sample chapters, latest updates and readers' comments. The Web version of this book has been viewed a total of:
2,441,549 times as of December 2023.
2,281,357 times as of December 2022.
2,137,746 times as of December 2021.
1,992,683 times as of December 2020.
1,866,739 times as of December 2019.
1,760,030 times as of December 2018.
1,666,610 times as of December 2017.
1,560,981 times as of December 2016.
1,426,899 times as of December 2015.
1,234,950 times as of December 2014.
1,007,278 times as of December 2013.
845,408 times as of December 2012.
631,149 times as of December 2011.
395,375 times as of December 2010.
208,671 times as of December 2009.
PDF/EPUB version: https://www.herongyang.com/Java-Tools/PDF-Full-Version.html - Provides information on how to obtain the full version of this book in PDF, EPUB, or other format.
Java Tools Tutorials - Herong's Tutorial Examples
∟ Java Tools Terminology
This section provides quick descriptions of terms related to Java tools.
Certificate: A digitally signed statement from the issuer saying that the public key of the subject has some specific value.
Certificate Chain: A series of certificates that one certificate signs the public key of the issuer of the next certificate. Usually the top certificate (the first certificate) is self-signed, where issuer signed its own public key.
jabswitch
: A Windows command to enable or disable the Java Access Bridge.
jaccessinspector
: A Windows GUI tool to examine accessible information about objects of a Java GUI application.
jaccesswalker
: A Windows GUI tool to navigate through the component trees of a Java GUI application.
JAR (Java ARchive): A platform-independent file format that aggregates many files into one. Multiple Java applets and their requisite components (.class files, images and sounds) can be bundled in a JAR file and subsequently downloaded to a browser in a single HTTP transaction, greatly improving the download speed.
jar
: The JAR manager - A command line tool for managing JAR files.
jarsigner
: The JAR Signer - A command line tool for signing JAR files and verifying signed JAR files.
java
: The Java launcher - A command line tool to launch Java applications.
javac
: The Java compiler - A command line tool to compile Java source files.
javap
: The Java Class File Disassembler - A command line tool that reads Java bytecode class files and disassembles them.
jconsole
: A graphical user interface tool that enables you to monitor and manage Java applications and virtual machines on a local or remote machine using the JMX technology.
jdb
: The Java Debugger - A command line tool to debug Java applications.
jdeps
: The Java Class Dependency Analyzer - A command line tool to show package level and class level dependencies.
JDI (Java Debug Interface)
: A high level Java API providing information useful for debuggers and similar systems needing access to the running state of a (usually remote) virtual machine.
JDK (Java Development Kit)
: A development environment for building software applications and software components using the Java programming language.
jhat
(discontinued since JDK 9) - Heap Dump Browser: Starts a Web server on a Java heap dump file (eg, produced by jmap -dump
), allowing the heap to be browsed.
jinfo
: Prints configuration information for a given JVM process or a Java core file on the local machine or on a remote machine through a debug server.
jlink
- JRE Linker: Assembles and optimizes a set of modules and their dependencies into a custom JRE.
jmap
- Memory Map: Prints shared object memory maps or heap memory details of a given JVM process or a Java core file on the local machine or on a remote machine through a debug server.
jmc
- Java Mission Control: Invokes a GUI tool suite for managing, monitoring, profiling, and troubleshooting your Java applications. When first installed, Java Mission Control consists of the JMX Console and the Java Flight Recorder.
JMX (Java Management Extensions)
: A Java standard API for management and monitoring of resources such as applications, devices, services, and the Java virtual machine. The JMX technology was developed through the Java Community Process (JCP) as Java Specification Request (JSR) 3, Java Management Extensions, and JSR 160, JMX Remote API.
JPDA (Java Platform Debugger Architecture)
: An infrastructure that allows user to build end-user debugger applications. It includes the following three-layered APIs:
Java Debug Interface (JDI), a high-level Java programming language interface, including support for remote debugging;
Java Debug Wire Protocol (JDWP), which defines the format of information and requests transferred between the debugging process and the debugger front end;
The JVM(TM) Tools Interface, JVM TI. This is a low-level native interface that defines the services a Java virtual machine provides for tools, including debugging. JVM TI is new in J2SE 5.0 and replaces JVMDI and JVMPI, both of which are deprecated and will be removed in a future release.
jps
- Java Process Status: A new Java tool that lists all JVM processes on the local machine or a remote machine. jps
tool is distributed as part of the JDK package and represented by the \Progra~1\java\jdk*\bin\jps.exe program file. jps
can be executed with the following syntax:
jrunscript
- Script Code Shell: Runs script code in JavaScript or other languages interactively or in batch mode.
jsadebugd
- Serviceability Agent Debug Daemon: Attaches to a JVM process or a Java core file and acts as a debug server for remote tools to connect.
jshell
- Java Shell: Provides an interactive shell for evaluating Java declarations, expressions, and statements.
jstack
- Stack Trace: Prints a stack trace of threads for a given JVM process or a Java core file on the local machine or on a remote machine through a debug server.
jstat
: A JVM statistics monitoring tool that displays performance statistics of a given JVM process with a specified sampling interval. jstat
tool is distributed as part of the JDK package and represented by the \Progra~1\java\jdk*\bin\jstat.exe program file. jstat
can be executed with the following syntax:
jstatd
: A server that allows JVM monitoring tools like jps
and jstat
to access JVM processes from a remote machine. jstatd
tool is distributed as part of the JDK package and represented by the \Progra~1\java\jdk*\bin\jstatd.exe program file. jstatd
can be executed with the following syntax:
jvisualvm
- Java VisualVM: A visual interface for viewing detailed information about Java applications while they are running on a Java Virtual Machine (JVM), and for troubleshooting and profiling these applications. Java VisualVM federates previously standalone tools like JConsole, jstat, jinfo, jstack, and jmap to obtain data from the JVM software, then re-organizes and presents the information graphically, to enable you to view different data about multiple Java applications uniformly, whether they are running locally or on remote machines.
JVM (Java Virtual Machine): A software that simulates a central process unit (Virtual Machine) to run compiled Java code.
keystore
: A database used by JDK keytool
command and KeyStore class to store your own private keys, and public key certificates you received from someone else.
keytool
: A command line tool introduced in JDK 1.2 to manage keys and certificates using keystore
. keytool
replaces the same functions offered by javakey
in JDK 1.1.
native2ascii
: Native-to-ASCII Encoding Converter - A command line tool that reads a text file stored in a non-ASCII encoding and converts it to an ASCII text file. All non-ASCII characters will be converted into \uXXXX sequences, where dddd is the Unicode code value of the non-ASCII character.
serialver: A command line tool that can be used to generate a unique serialVersionUID
value for any given serializable Java class.
ZIP: A file format is a popular data compression and archival format. A ZIP file contains one or more files that have been compressed or stored.
Java Tools Tutorials - Herong's Tutorial Examples
∟ Java Tools Included in JDK
This chapter provides tutorial notes on Java tools included in the Oracle JDK package. Topics include downloading and installing the latest JDK version on Windows; using 'javac' and 'java' tools to compile and run Java program; listing Java tools in the 'bin' sub-directory of Java home directory.
Installing Latest JDK on macOS
Installing Latest JDK on Windows
Adding JDK bin
Direcotry to Path Setting
Testing JDK Installation
Listing Java Tools in JDK
Takeaways:
Installation of Oracle JDK package is easy.
There are about 30 to 50 Java related tools included in the bin
directory in different versions of Oracle JDK packages!
Adding JDK bin
directory to path
environment variable lets me run Java tools without typing the directory path.
Java Tools Tutorials - Herong's Tutorial Examples
∟ Java Tools Included in JDK
∟ Installing Latest JDK on macOS
This section provides a tutorial example on how to download and install the latest version JDK, which includes some nice Java tools, on a macOS system.
As a Java developer kit, the Oracle JDK package includes a number of nice Java tools.
Here is what I did to download and install JDK 20, also called Java SE 20, on my macOS computer.
1. Go to Oracle Java SE download website at oracle.com/technetwork/java/javase/downloads.
2. Click JDK 20 > macOS
tab.
3. Click on the jdk-20_macos-x64_bin.dmg
link in the x64 DMG Installer
line to download the installation file to your Downloads
directory.
4. Double-click on the jdk-20_macos-x64_bin.dmg
file to install it.
To test the installation, open a command window to try the java command.
herong$ java -version
java version 20.0.1
2023-04-18
Java(TM) SE Runtime Environment (build 20.0.1+9-29)
Java HotSpot(TM) 64-Bit Server VM (build 20.0.1+9-29, mixed mode, sharing)
Cool, I have successfully installed JDK 20 on my macOS computer!
Java Tools Tutorials - Herong's Tutorial Examples
∟ Java Tools Included in JDK
∟ Installing Latest JDK on Windows
This section provides a tutorial example on how to download and install the latest version JDK, which includes some nice Java tools, on a Windows system.
As a Java developer kit, the Oracle JDK package includes a number of nice Java tools.
Here is what I did to download and install JDK 17, also called Java SE 17, on my Windows computer.
Open the Java SE Download page with this URL: https://www.oracle.com/java/technologies/downloads/.
Click the Windows
tab under the Java SE Development Kit 17.0.1 downloads
. You will see a new page with a list of different download files of JDK 17.
Click the hyper link of https://download.oracle.com/java/17/latest/jdk-17_windows-x64_bin.exe
, next to x64 Installer 152 MB
.
Save jdk-17_windows-x64_bin.exe to a temporary directory.
Double-click on jdk-17_windows-x64_bin.exe to start the installation wizard.
The installation wizard will guide you to finish the installation.
To test the installation, open a command window to try the java command. If you are getting the following output, your installation is good:
herong> \progra~1\java\jdk-17.0.1\bin\java -version
java version 17.0.1
2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM
(build 17.0.1+12-LTS-39, mixed mode, sharing)
Cool, I have successfully installed JDK 17 on my Windows computer!
Java Tools Tutorials - Herong's Tutorial Examples
∟ Java Tools Included in JDK
∟ Adding JDK bin
Direcotry to Path Setting
This section provides a tutorial on how to add JDK 'bin' directory to the 'path' system envirnoment variable.
In order to run Java tools by typing their program file name without the directory path name, I updated the path
environment variable on my Windows computer:
Open Control Panel > System and Security > System
.
Click Advanced system settings
.
Click Environment Variables
.
Select System variables > Path
and click Edit
.
Add C:\Progra~1\java\jdk-17.0.1\bin
to the beginning of the current path list.
Click OK
to save the change.
Then I ran the echo %path%
command in a new command window to confirm the change:
herong> echo %path%
C:\Progra~1\java\jdk-17.0.1\bin;...
Now I should be able to run Java tool commands without the directory path name:
herong> java -version
java version 17.0.1
2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM
(build 17.0.1+12-LTS-39, mixed mode, sharing)
herong> javac hello.java
herong> java Hello
Hello world!
Now I am ready to play with Java tools included in Oracle JDK package!
Adding JDK bin Direcotry to Path SettingAdding JDK bin
Direcotry to Path Setting
You can also set a new environment variable called java_home
to avoid typing the full path name to access Java tool program