Quick Start (TL;DR)
If you’re eager to try building the JDK, these simple steps work most of the time:Run configure
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.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:- JDK Project (main-line currently in development): https://git.openjdk.org/jdk
- JDK Updates Project (one repository per update release):
- JDK 17 updates: https://git.openjdk.org/jdk17u
- Other update versions follow the same pattern
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:Path and location requirements
Path and location requirements
- 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-8oren_US.UTF-8locale is available.
Windows-specific requirements
Windows-specific requirements
- Short names: Ensure all relevant paths have short names enabled. Check with
fsutil 8dot3name query. - Cygwin permissions: If using Cygwin, create directories using
mkdirin 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.autocrlftofalse.
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
build/linux-x64-server-release and is referred to as $BUILD in the documentation.
Build Output Structure
After building, the$BUILD directory contains:
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:- Configure phase: Detect system, locate tools, set options
- Build phase: Compile native code and Java code
- Image creation: Package the build into distributable images
gensrc- Generate source code to compilegendata- Generate non-source code artifactscopy- Copy resource artifactsjava- Compile Java codelaunchers- Compile native executableslibs- Compile native libraries
Supported Platforms
The mainline JDK project supports:| Operating System | Supported Toolchain |
|---|---|
| Linux | gcc, clang |
| macOS | Apple Xcode (clang) |
| Windows | Microsoft Visual Studio |
| AIX | IBM Open XL C/C++ |
Oracle Build Configurations
Oracle uses these OS versions for daily JDK builds:| Operating System | Version |
|---|---|
| Linux/x64 | Oracle Enterprise Linux 6.4 / 8.x |
| Linux/aarch64 | Oracle Enterprise Linux 7.6 / 8.x |
| macOS | macOS 14.x |
| Windows | Windows Server 2016 |
Toolchain Versions
Oracle currently uses these toolchain versions:| Platform | Toolchain Version |
|---|---|
| Linux | gcc 14.2.0 |
| macOS | Apple Xcode 15.4 (clang 15.0.0) |
| Windows | Visual 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