JRE vs JDK: Differences, JVM and Which Java Package to Install
A JRE (Java Runtime Environment) runs compiled Java programs. A JDK (Java Development Kit) provides runtime capabilities plus a compiler and development tools, so choose a JDK when learning Java or building source code. To run an existing application, follow its runtime requirements; an application that bundles its own runtime may need no separate Java installation.
What is a JRE?
A JRE is the environment needed to run compiled Java programs. It combines a JVM (Java Virtual Machine), standard class libraries, and supporting runtime files. Bytecode is the instruction format used by the JVM, usually stored in .class files produced from Java source code.
A typical runtime-only JRE package does not provide the javac source compiler. Being able to run java therefore does not prove that development tools are installed. Also distinguish the concept of a runtime environment from the package names available on a particular download site.
What is a JDK?
A JDK supplies tools for developing and running Java programs. Use javac to compile source files and java to run programs. A development JDK already provides execution capabilities, so you do not need a second JRE installation merely to run programs with that JDK.
javaccompiles.javasource files into.classfiles.javastarts the JVM and launches a Java program.jarpackages classes and resources into a JAR (Java Archive) file.javadocgenerates API (Application Programming Interface) documentation from declarations and documentation comments.jdbsupports debugging, including stopping execution and inspecting variables.
This does not mean a JDK includes every editor or IDE (Integrated Development Environment). You can choose an editor separately, and an IDE may require you to select a project JDK for building code. The compiler’s role is described in Oracle’s javac reference.
How do the JVM, JRE and JDK relate?
The JVM is the component that executes bytecode. A JRE adds libraries and supporting files to form a runtime environment; a JDK adds development tools while also providing runtime capabilities. These terms describe different roles and scopes.
For example, javac turns HelloWorld.java into HelloWorld.class, and java HelloWorld launches the program on a JVM. A class file can run on another operating system with a compatible runtime, but applications using native libraries or particular Java versions have additional requirements. See the Java Virtual Machine specification introduction for the relationship between the JVM and class files.
JRE vs JDK comparison
| Criterion | Runtime-only JRE | JDK |
|---|---|---|
| Main purpose | Run compiled applications | Develop, compile and run applications |
| JVM and runtime libraries | Included | Included |
| java launcher | Typically available | Available |
| javac compiler | Typically absent | Available |
| When to choose it | An application requires a compatible external runtime | Learning Java, building source code or development work |
| Download availability | Depends on vendor, version and operating system | Choose a vendor and supported platform |
This table compares the usual roles of a runtime-only package and a development kit. A custom runtime may contain a different selection of modules, so its name alone does not guarantee every library or tool is present.
Does a modern JDK contain a JRE folder?
“The JDK includes the JRE” is useful shorthand for runtime capabilities, but it is not an accurate description of every current directory layout. JDK 8 and earlier used an internal jre/ directory; JDK 9 introduced modular runtime images. Oracle stopped offering separate JRE and Server JRE downloads with JDK 11. The Oracle JDK 11 migration guide explains these packaging and layout changes.
That does not mean every vendor stopped distributing runtime-only packages. The Eclipse Temurin download page distinguishes JDK and JRE packages; check what is actually available for your required version and operating system. A packaging change made by one vendor is not a universal Java rule.
Developers can also use the JDK’s jlink tool to assemble required modules and their dependencies into a custom runtime image. Bundling such a runtime with an application can reduce the need for a separately installed system JRE. Its module selection and updates remain the distributor’s responsibility, as explained in the jlink reference.
Which package and version should you choose?
- Learning and development: choose the JDK version required by your course or project, including the versions supported by build tools and libraries.
- Running an existing application: check its installation instructions for the required Java version and whether it needs an external runtime. Changing system Java may have no effect on an application with a bundled runtime.
- Server deployment: match the required modules, operating system and CPU architecture. A server that also builds source code or needs JDK tools may require a JDK.
A larger version number alone does not guarantee compatibility. For example, a Java 17 runtime cannot necessarily read a class compiled for Java 21. Running an older application on newer Java also requires checking removed features and library compatibility.
For your own source code, consider javac --release when targeting an earlier supported Java release. It constrains language features, platform APIs and class-file output, but does not automatically make external dependencies compatible. Test the result on the actual target runtime.
Install a JDK and check the selected executables
On an official download page, select the package type, Java version, operating system and CPU architecture, such as x64 or ARM64. If the distributor provides checksums, you can verify the downloaded file using its hash before installation.
Windows installation and checks
With an Eclipse Temurin MSI installer, use Custom Setup to select the installation directory and features. Adding Java to PATH helps command-line use; select the JAVA_HOME feature if your build tools need it. See the Temurin Windows installation guide for these options. After installation, close existing terminals and open a new one.
java -version javac -version
Check that both commands work and report the intended Java major version. If only java -version works, the runtime was found but the compiler might not be available. In PowerShell, inspect the selected paths with:
Get-Command java,javac | Select-Object Name,Source
PATH is the list of locations a terminal searches for executable files. JAVA_HOME identifies a JDK location for tools that use that variable; point it at the JDK root, not its bin directory. If the two settings refer to different installations, a terminal and a build tool can use different Java versions.
macOS and Linux checks
Use a package or installer matching your operating system; consult the Temurin platform installation guides for the actual procedure. After installation, run java -version and javac -version. To inspect what your shell resolves, use:
command -v java command -v javac
The result may be a symbolic link or version-manager location, so do not infer the Java version from a path alone. Check the IDE’s project JDK and the build result too. Selecting a new JDK per project before removing an older installation makes it easier to return to a working configuration.
See compilation and execution in a small example
With a JDK available, create an empty working directory and save this source as HelloWorld.java. Match the filename’s capitalization to the class name, and ensure an editor has not added a .txt extension. The example uses no package declaration or external libraries.
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, Java!");
}
}
Open a terminal in the directory containing the file, then run these commands in order:
javac HelloWorld.java java -cp . HelloWorld
The first command creates a class file. The second searches the current directory (.) for the HelloWorld class and runs it. Do not append .class to the class name. The expected output is:
Hello, Java!
JDK 11 and later can also launch a source file directly with java HelloWorld.java. This performs compilation internally, so the launcher’s name does not imply that a runtime-only JRE can perform the same operation. The two-step example makes the source/class distinction visible. See the java reference on source-file execution for its conditions.
To package the compiled class into an executable JAR, run the following in the same directory after HelloWorld.class has been created:
jar --create --file hello.jar --main-class HelloWorld HelloWorld.class java -jar hello.jar
Creating the archive uses a development tool; running this finished JAR requires a compatible runtime. Other applications may need additional libraries or launch options. See the jar command reference for archive creation options.
Troubleshoot common installation and launch problems
| Symptom | What to check | How to proceed |
|---|---|---|
| java or javac is not found | The executable exists and PATH includes the intended JDK’s bin directory | Open a fresh terminal; also check the executable using its full path |
| java works, javac does not | A runtime-only package or mixed executable paths | Install a development JDK or select an existing JDK’s path |
| UnsupportedClassVersionError | The runtime supports the class-file version | Use a compatible runtime; rebuild your own code for the target release if appropriate |
| Could not find or load main class | Class name, working directory and classpath | For this example, run java -cp . HelloWorld in the directory containing HelloWorld.class |
| Works in the IDE, fails in the terminal | Project JDK versus terminal java and javac | Check the IDE, PATH, JAVA_HOME and build-tool JDK selection separately |
When diagnosing a failure, first establish which executable is actually running. Once the paths and versions are correct and the small example works, investigate the application’s dependencies and launch options.





