The Java Development Kit (JDK) is the software package you need to write, compile, run, debug and package Java programs. It contains the Java compiler (javac), the Java Virtual Machine (JVM), the standard class library and a set of command-line tools. Install a JDK, not just a runtime, whenever you develop Java.
Since Java 11 there is no separate JRE download from most vendors: the JDK is the standard distribution, and you can build a trimmed runtime for deployment with jlink.
| Part | What it does |
|---|---|
| JVM | Loads classes, verifies bytecode and runs it with a JIT compiler and garbage collector |
| Class library | The Java SE API (java.base, java.sql, java.net.http and other modules) |
javac | Compiles .java source into .class bytecode |
java | Launches an application (and can run a single source file directly) |
jar | Packages classes and resources into a JAR file |
javadoc | Generates API documentation from comments |
jshell | Interactive REPL for trying code quickly |
jlink, jpackage | Build a custom runtime image and native installers |
jdeps, jcmd, jfr | Analyze dependencies, diagnose a running JVM and record profiling data |
The JDK is a superset of the JRE (Java Runtime Environment), which only ran programs. Oracle stopped shipping a standalone JRE for Java 11 and later.
You write source, compile it with the JDK, and run the resulting bytecode on any JVM of a compatible version.
Save this as Hello.java:
Compile and run it in two steps:
The first command produces Hello.class. The second starts a JVM and runs it. The number printed is the feature version of the JDK you are running.
Since Java 11 you can skip the compile step for a single file:
Recent releases also simplify beginner programs: Java 25 finalized compact source files and instance main methods, so a small program no longer needs the public static void main(String[] args) ceremony.
Oracle publishes a feature release every six months, and a long-term support (LTS) release every two years. The current LTS releases are Java 8, 11, 17, 21 and 25. For production, choose an LTS release, and prefer the newest one your frameworks support. Non-LTS releases are supported only until the next release.
The JDK source comes from the OpenJDK project, and several vendors build and support binaries from it:
They are functionally equivalent for most projects. Differences lie in support terms, licensing and update schedules, so check the vendor's license before using it in production.
JAVA_HOME to the JDK directory and add its bin directory to PATH.If java works but javac is not found, you have only a runtime, or PATH points to a different installation. Install a full JDK and fix PATH.
jdeps tells you which modules an application needs, and jlink uses that list to build a small runtime image. jpackage then wraps your application and runtime into a native installer.
The JRE could only run Java programs. The JDK also contains the compiler and developer tools. Modern JDKs include everything the old JRE had.
Technically a runtime is enough, but since Java 11 the common choice is simply to install a JDK, or to ship an application with a runtime built by jlink.
They are built from the same source, and recent Oracle builds are closely aligned with OpenJDK. They differ mainly in packaging, license terms and support.
Use the latest LTS that your build tools and frameworks support, currently Java 21 or 25 for most new projects.
The JDK bundles the compiler, JVM, class library and tools you need to build Java applications. Install a current LTS release from a trusted vendor, confirm that javac -version works, and use jshell, jlink and jpackage as your projects grow.