Adding JDK "bin" Directory 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 compiler and JVM by typing their program file name without the directory path name, I updated the "path" environment variable on my Windows computer:

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;
   C:\Program Files\Common Files\Oracle\Java\javapath;
   C:\ProgramData\Oracle\Java\javapath;
   ...

Now I should be able to run Java commands without the directory path name:

herong> java -version

java version "17.0.1" 2021-10-19 LTS
...

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 Directory to Path Setting
Adding JDK "bin" Directory 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 files:

herong> set java_home=C:\Progra~1\java\jdk-17.0.1

herong> %java_home%\bin\java -version

java version "17.0.1" 2021-10-19 LTS
...

Table of Contents

 About This Book

JDK - Java Development Kit

 Downloading and Installing JDK on Mac

 Downloading and Installing JDK on Windows

Adding JDK "bin" Directory to Path Setting

 Downloading and Installing JDK on Linux

 Writing My First Java Program

 JDK Documentation Installation

 Execution Process, Entry Point, Input and Output

 Primitive Data Types and Literals

 Control Flow Statements

 Bits, Bytes, Bitwise and Shift Operations

 Managing Bit Strings in Byte Arrays

 Reference Data Types and Variables

 Enum Types and Enum Constants

 StringBuffer - The String Buffer Class

 System Properties and Runtime Object Methods

 Generic Classes and Parameterized Types

 Generic Methods and Type Inference

 Lambda Expressions and Method References

 Java Modules - Java Package Aggregation

 Execution Threads and Multi-Threading Java Programs

 ThreadGroup Class and "system" ThreadGroup Tree

 Synchronization Technique and Synchronized Code Blocks

 Deadlock Condition Example Programs

 Garbage Collection and the gc() Method

 Assert Statements and -ea" Option

 Annotation Statements and Declarations

 Java Related Terminologies

 Archived Tutorials

 References

 Full Version in PDF/EPUB