Java JDK

Su Suriya Ravichandran Updated 14 Nov 2026
5 min read ·Lesson 32 of 306

The JDK (Java Development Kit) is the complete toolkit for building Java software. It contains the compiler, the runtime, the standard class library, and a set of command-line tools for packaging, documenting, inspecting, and troubleshooting Java programs. Every Java IDE and build tool works by calling the tools inside a JDK.

What Is Inside a JDK

A JDK installation is an ordinary directory. Its layout is the same for every vendor:

jdk-25/
├── bin/        executables: java, javac, jshell, jar, javadoc, jlink, jcmd, ...
├── conf/       configuration: security policy, logging, network properties
├── include/    C header files for writing native code (JNI)
├── jmods/      the platform modules in a form jlink can package
├── legal/      licence files for each component
├── lib/        the JVM itself, the class library (modules file), and supporting files
└── release     a text file describing the version and included modules

The release file is a quick way to identify an unknown installation:

cat $JAVA_HOME/release
JAVA_VERSION="25.0.1"
IMPLEMENTOR="Eclipse Adoptium"
...

The standard class library

The thousands of classes you use without writing them (String, ArrayList, HashMap, Files, HttpClient, LocalDate) are part of the JDK. Since Java 9 they are organized into modules such as java.base (core language classes), java.sql (JDBC), java.net.http (HTTP client), and java.desktop (Swing and AWT). You can list them:

java --list-modules
java.base@25.0.1
java.compiler@25.0.1
java.datatransfer@25.0.1
java.desktop@25.0.1
...

Every program automatically has access to java.base. Code on the classpath (the normal case for beginners) can use all the standard Java SE modules without any configuration.

The Core Tools

ToolPurpose
javacCompiles .java source files into .class bytecode
javaStarts a JVM and runs a program (a class, a JAR, or a single source file)
jshellInteractive console: evaluate Java statements and expressions immediately
jarPackages compiled classes and resources into a .jar archive
javadocGenerates HTML API documentation from /** ... */ comments
javapDisassembles .class files to show their methods and bytecode
jdepsAnalyses which packages and modules a JAR depends on
jlinkBuilds a minimal custom runtime image containing only the modules an app needs
jpackageCreates native installers (.msi, .pkg, .deb, .rpm) for an application
jcmdSends diagnostic commands to a running JVM (thread dumps, heap info, GC)
jstack, jmap, jstatInspect threads, memory, and GC statistics of a running JVM
jfrReads recordings from Java Flight Recorder, the built-in profiler
keytoolManages keystores of certificates and keys for TLS

Beginners use javac, java, and jshell constantly. The others become important when packaging, deploying, and troubleshooting applications, and each is covered in later sections.

The Development Cycle Using JDK Tools

Hello.java  --javac-->  Hello.class  --jar-->  app.jar  --java-->  running program
   source                bytecode            packaged

A minimal walk-through:

// Hello.java
public class Hello {
    public static void main(String[] args) {
        System.out.println("Built with the JDK");
    }
}
javac Hello.java                       # produces Hello.class
java Hello                             # runs it
jar --create --file app.jar --main-class Hello Hello.class   # packages it
java -jar app.jar                      # runs the packaged app

Output (from both java commands):

Built with the JDK
  • javac checks the code and produces Hello.class.
  • java Hello runs the class by name (no .class extension).
  • jar --create builds a ZIP-format archive. --main-class Hello records the entry point in the JAR's manifest, so java -jar app.jar knows which class to start.

Inspecting a class with javap

javap Hello
Compiled from "Hello.java"
public class Hello {
  public Hello();
  public static void main(java.lang.String[]);
}

javap reads a compiled class and lists its members. Notice public Hello();: the compiler added a default constructor that was never written in the source. Adding -c shows the bytecode instructions inside each method, which is useful for understanding what the compiler actually generates.

JDK Versus JRE Versus JVM

ContainsUsed for
JVMThe execution engine: class loading, bytecode verification, interpreter, JIT compiler, garbage collectorRunning bytecode
JREJVM + standard class libraryRunning Java applications
JDKJRE + development tools (javac, jar, jshell, javadoc, ...)Writing, building, and running Java applications

Each layer contains the one beneath it. The JRE and JVM have their own lessons. Since Java 11, vendors distribute the JDK as the standard download; a minimal runtime for deployment is produced with jlink instead.

JDK Versions

A JDK's version determines which language features the compiler accepts and which APIs the library provides. The --release option compiles code for an older target version using a newer JDK:

javac --release 17 Hello.java

The compiler then rejects language features and API calls that do not exist in Java 17, and produces class files that a Java 17 JVM can run. This is how libraries built with a modern JDK stay compatible with users on older versions.

To see what a JDK supports:

javac --help          # options, including --release
java -version         # runtime version
javac -version        # compiler version

A full JDK is several hundred megabytes. A deployed application needs only the modules it actually uses. jdeps finds them, and jlink packages a runtime containing only those:

jdeps --print-module-deps app.jar
# java.base,java.net.http

jlink --add-modules java.base,java.net.http \
      --output myruntime \
      --strip-debug --no-header-files --no-man-pages

./myruntime/bin/java -jar app.jar

myruntime is a self-contained runtime, often tens of megabytes rather than hundreds, that can be shipped with the application or placed in a small Docker image. This is the modern replacement for installing a separate JRE on every machine.

JShell: Experimenting Without Files

JShell runs Java code immediately, without a class, a main method, or compilation:

jshell> var names = List.of("Ada", "Linus", "Grace")
names ==> [Ada, Linus, Grace]

jshell> names.stream().map(String::toUpperCase).toList()
$2 ==> [ADA, LINUS, GRACE]

jshell> Math.sqrt(2)
$3 ==> 1.4142135623730951

It is the fastest way to check how an API behaves or test a small expression. JShell has its own lesson later in this section.

Diagnosing a Running Program

The monitoring tools work on any running Java process. jcmd with no arguments lists JVMs on the machine:

jcmd
48213 Hello
48290 jdk.jcmd/sun.tools.jcmd.JCmd

Then send commands to one of them by process ID:

jcmd 48213 VM.version         # version of that JVM
jcmd 48213 Thread.print       # stack trace of every thread
jcmd 48213 GC.heap_info       # heap usage

A thread dump is the first thing to collect when an application hangs: it shows exactly where each thread is waiting. These tools ship with every JDK, which is one reason production servers often run a full JDK rather than a stripped runtime. They are covered further in the JVM Monitoring lesson.

0 Comments

Reviewed before they appear

No comments yet.

Java
Java Introduction Java Features Java Syntax Java Comments Java Statements Java Output Java Variables Java Data Types Java Type Casting Java Operators Java Strings Java Numbers Java Math Java Booleans Java User Input Java Conditions Java If Else Java Switch Java While Loop Java For Loop Java Break Java Continue Java Arrays Java Methods Java Parameters Java Return Values Java Scope Java Recursion Install Java Install JDK Java IDEs Java JDK Java JRE Java JVM Java Compiler Java File Compile Java Run Java JShell Basics Java Packages Java OOP Java Classes Java Objects Class Methods Constructors Constructor Overload this Keyword static Keyword final Keyword Encapsulation Inheritance Polymorphism Abstraction Access Modifiers super Keyword Method Overload Method Override Instanceof Operator Nested Classes Inner Classes Anonymous Classes Enums Records Array Basics Array Length Loop Arrays Multidimensional Arrays Array Copy Array Sorting Array Search ArrayList LinkedList HashSet TreeSet HashMap TreeMap Queue Interface Deque Interface Stack Class Iterator List Interface Set Interface Map Interface Collections Class Comparable Comparator Generics Basics Generic Classes Generic Methods Wildcards String Basics String Length String Methods String Concatenation String Compare String Search String Replace String Split String Format StringBuilder StringBuffer Text Blocks Regular Expressions Number Types Integer Class Float Class Double Class BigInteger BigDecimal Math Class Random Numbers Number Format Date Basics LocalDate LocalTime LocalDateTime ZonedDateTime Date Formatting Date Parsing Period Class Duration Class Java Instant Class Java Exception Basics Java try...catch Java Multiple Catch Blocks Java finally Block Java throw Keyword Java throws Keyword Java Checked Exceptions Java Unchecked Exceptions Java Custom Exceptions Java try-with-resources Java Exception Chaining Java File Basics Java Create Files Java Read Files Java Write Files Java Delete Files Java File Paths Java File Class Java BufferedReader Java BufferedWriter Java FileInputStream Java FileOutputStream Java Object Streams Java Directory Handling Java NIO Basics Java Files API Java Input Java Scanner Class Java Console Input Java PrintStream Java InputStream Java OutputStream Java Reader Class Java Writer Class Java Buffered Streams Java Data Streams Java Generics Introduction Java Generic Types Java Generic Methods Java Bounded Types Java Wildcards Java Type Erasure Java Generic Interfaces Java Generic Collections Java Lambda Basics Java Lambda Syntax Java Functional Interfaces Java Method References Java Stream API Java Stream Creation Java Stream Filter Java Stream Map Java Stream Reduce Java Stream Sort Java Stream Collect Java Collectors Class Java Optional Class Java Parallel Streams Java Threads: Thread Basics Create a Thread in Java Java Thread Class Java Runnable Interface Java Thread States Java Thread Sleep Java Thread Join Java Thread Priority Java Synchronization Java Thread Safety Java Race Conditions Java Deadlocks Java Executor Service Java Thread Pools Java Callable Interface Java Future Interface Java CompletableFuture Java Concurrent Collections Java Atomic Classes Java Virtual Threads Java Networking Basics Java URL Class Java URI Class Java HttpClient Java HTTP Requests Java HTTP Responses Java Socket Basics Java ServerSocket Java DatagramSocket Java WebSocket Basics Java JDBC Basics Java JDBC Setup Java Database Connection Java JDBC Connection Interface Java JDBC Statement Java PreparedStatement Java ResultSet Java JDBC CRUD Operations Java JDBC Transactions Java JDBC Batch Update Java Connection Pooling with HikariCP Java JPA Basics: Entities, EntityManager and JPQL Java Hibernate Basics: SessionFactory, Session and HQL Package in Java: Basics Explained with Examples Create Package in Java: Step-by-Step Guide with Examples Import Package in Java: The import Statement Explained Access Control in Java: Packages, Classes and Members JAR File in Java: Create, Run and Inspect JAR Files Java Modules: Introduction to the Java Module System module-info in Java: Every Module Directive Explained Java Module Path: How --module-path Finds Your Modules Java Classpath: How -cp and CLASSPATH Find Your Classes Java Annotations: Basics of @ Metadata in Java Java Built-in Annotations: @Override, @Deprecated and More Java Custom Annotations: Create Your Own @interface Java Annotation Targets: @Target and ElementType Explained Java Reflection API: Inspect and Use Classes at Runtime Java Class Metadata: Names, Modifiers, Hierarchy and Generic Java Dynamic Objects: Create Objects Dynamically With Reflec Java Dynamic Proxy: Intercept Method Calls With Proxy and In Java Security Java Secure Coding Java Password Hashing Java Input Validation Java Cryptography Basics Java KeyStore Basics Java TLS Basics Java SecureRandom Java JUnit Basics Java JUnit Test Methods JUnit Assertions JUnit Test Fixtures JUnit Parameterized Tests Mockito in Java Java Mock Objects Java Integration Testing Java Code Coverage Maven in Java Create a Maven Project in Java Maven Dependencies Maven Plugins Gradle in Java Gradle Build Gradle Dependencies Build Executable JAR in Java Build WAR File in Java HTTP Basics in Java Java Servlet Basics Servlet Lifecycle in Java HttpServletRequest in Java HttpServletResponse in Java JSP in Java JSTL in JSP REST API in Java JSON in Java Java Web Application Spring Framework Basics Spring Boot Tutorial Spring MVC Spring Data JPA Spring Security Spring Boot REST API Jakarta EE Basics Java Deployment JAR Deployment Java WAR Deployment Run Java as a Service Docker Java: Dockerize a Java Application Java Environment Variables and Configuration Java Logging Basics Java Production Setup Java JVM Options Java JVM Monitoring Java Hello World App Java Calculator App Java Number Guess Game Java Student Manager Java Library System Java Bank App Java Todo App Java File Manager Java Quiz App Java REST API Project Java Chat Server Java Employee Manager Java E-commerce API
Ask about this post
AI Ask about this post

Ask questions about Java JDK and get answers drawn from it.

Signed-in readers only.