Skip to main content
The JDK is a complex software project that requires a certain amount of technical expertise, a fair number of dependencies on external software, and reasonably powerful hardware.

Quick Start (TL;DR)

If you’re eager to try building the JDK, these simple steps work most of the time:
1

Get the source code

Clone the main-line JDK repository:
git clone https://git.openjdk.org/jdk
2

Run configure

bash configure
If configure fails due to missing dependencies (toolchain, build tools, external libraries, or boot JDK), it will usually print a suggestion on how to resolve the issue on your platform.
3

Run make

make images
4

Verify the build

./build/*/images/jdk/bin/java -version
5

Run basic tests

make test-tier1
If any of these steps fail, refer to the detailed requirements and troubleshooting sections in this documentation.

Getting the Source Code

Available Repositories

Make sure you are getting the correct version. Commonly used repositories include:
If you want to build an older version (e.g., JDK 17), use the Updates repository (e.g., jdk17u) which contains incremental updates, rather than the frozen release repository (jdk17).

Special Considerations

For a smooth building experience, follow these rules:
  • No spaces in path: Do not check out source code in a path containing spaces. The build will likely fail.
  • Avoid long paths: Do not use very long paths or deeply nested directories. You may hit OS limitations.
  • Use local disk: Put source code on a local disk, not a network share. Use an SSD if possible for best performance.
  • UTF-8 support: On Unix systems, ensure C.UTF-8 or en_US.UTF-8 locale is available.
  • Short names: Ensure all relevant paths have short names enabled. Check with fsutil 8dot3name query.
  • Cygwin permissions: If using Cygwin, create directories using mkdir in bash shell, not Windows Explorer.
  • Avoid Cygwin home: Do not put the JDK clone in your Cygwin home directory, especially if it contains spaces or mixed case letters.
  • Git client: Choose between Cygwin git (better path handling) or Git for Windows (better Skara support). If using Git for Windows, set core.autocrlf to false.

Build System Architecture

Configuration System

The build system uses Autoconf to detect your system and create a configuration. A configuration consists of:
  • A directory to store build output
  • Information about the platform and build machine
  • Choices that affect how the JDK is built
The configuration directory is typically named like build/linux-x64-server-release and is referred to as $BUILD in the documentation.

Build Output Structure

After building, the $BUILD directory contains:
build/<configuration-name>/
├── buildtools/      # Tools compiled for the build platform
├── configure-support/
├── hotspot/         # Intermediate files for hotspot
├── images/          # Output of *-image make targets
│   ├── jdk/        # JDK image from 'make images'
│   ├── docs/       # Documentation from 'make docs-image'
│   └── test/       # Test image from 'make test-image'
├── jdk/            # Exploded image (runnable after 'make jdk')
├── make-support/
├── support/        # Intermediate build files
│   ├── gensrc/    # Generated source code
│   └── modules_*/ # Per-module file hierarchy
├── test-results/
└── test-support/
The exploded image in $BUILD/jdk can be used immediately after running make jdk. Launch it with $BUILD/jdk/bin/java.

Build Phases

The build process is divided into phases:
  1. Configure phase: Detect system, locate tools, set options
  2. Build phase: Compile native code and Java code
  3. Image creation: Package the build into distributable images
Each module can have these sub-phases:
  • gensrc - Generate source code to compile
  • gendata - Generate non-source code artifacts
  • copy - Copy resource artifacts
  • java - Compile Java code
  • launchers - Compile native executables
  • libs - Compile native libraries

Supported Platforms

The mainline JDK project supports:
Operating SystemSupported Toolchain
Linuxgcc, clang
macOSApple Xcode (clang)
WindowsMicrosoft Visual Studio
AIXIBM Open XL C/C++
The 32-bit x86 port is deprecated and may be removed in a future release.

Oracle Build Configurations

Oracle uses these OS versions for daily JDK builds:
Operating SystemVersion
Linux/x64Oracle Enterprise Linux 6.4 / 8.x
Linux/aarch64Oracle Enterprise Linux 7.6 / 8.x
macOSmacOS 14.x
WindowsWindows Server 2016

Toolchain Versions

Oracle currently uses these toolchain versions:
PlatformToolchain Version
Linuxgcc 14.2.0
macOSApple Xcode 15.4 (clang 15.0.0)
WindowsVisual Studio 2022 version 17.13.2
All compilers must support C11 for C code and C++14 for C++ code.

Next Steps

Build Requirements

Learn about hardware, software, and toolchain requirements

Configuration

Explore configure script options and settings

Compilation

Understand make targets and the build process

Troubleshooting

Fix common build issues and problems

Build docs developers (and LLMs) love