HowToBuild
- Prerequisites
- Get the sources
- CMake and other tools
- Build OpenJDK 8
- Build OpenJDK 11
- Build OpenJDK Latest
- Installer and code signing
- Debug builds
- Development Builds
- Windows 2012 (or later)
x86_64
- user account with Administrator permissions
- Git for Windows (download)
Clone the top level repository:
git clone https://github.com/ojdkbuild/ojdkbuild
cd ojdkbuild
During the development, some build configurations may be broken in the latest master
branch. It may be better to use one of release tags instead:
git checkout <tag>
Top level repository contains a number of submodules, to get all of them run:
git submodule update --init
To get only the subset of submodules modules.bat script can be used with one of the profiles the following way:
resources\scripts\modules.bat resources/profiles/jdk8.gitmodules.txt
CMake is used to configure the build. All tools (including CMake), required for the build, are included in git submodules. All the commands below assume that these "bundled" tools are used.
Setup the environment:
For x86_64
:
call "resources/scripts/set-compile-env-vs10-x86_64.bat"
For x86
:
call "resources/scripts/set-compile-env-vs10-x86.bat"
Configuration and the build process are the same for both x86_64
and x86
, just the additional parameter -Dopenjdk_ENABLE_32_BIT=ON
must be specified to CMake for 32-bit builds.
Create build directory:
mkdir build
cd build
Build installer without OpenJFX:
cmake ../src/java-1.8.0-openjdk -G "NMake Makefiles"
nmake installer
Build installer with OpenJFX:
cmake ../src/java-1.8.0-openjdk -G "NMake Makefiles" -Dopenjdk_ENABLE_OPENJFX=ON
nmake installer
Resulting artifacts are placed into <ojdkbuild>/dist
directory (-Dopenjdk_DEST_DIR=path/to/dir
CMake option).
Note: OpenJFX build files are NOT written to the <ojdkbuild>/build
directory where CMake is run, but to the <ojdkbuild>\upstream\openjfx-8u
directory. The following command may be used before the subsequent builds to ensure that OpenJFX source directory is clean:
cd "upstream/openjfx-8u"
git clean -dxf
Likewise JDK Mission Control build files are NOT written to the <ojdkbuild>/build
directory where CMake is run, but to the <ojdkbuild>\upstream\jmc
directory. The following command may be used before the subsequent builds to ensure that JMC source directory is clean:
cd "upstream/jmc"
git clean -dxf
Setup the environment:
call "resources/scripts/set-compile-env-vs15-x86_64.bat"
Build installer:
cmake ../src/java-11-openjdk -G "NMake Makefiles"
nmake installer
Note: JDK Mission Control build files are NOT written to the <ojdkbuild>/build
directory where CMake is run, but to the <ojdkbuild>\upstream\jmc
directory. The following command may be used before the subsequent builds to ensure that JMC source directory is clean:
cd "upstream/jmc"
git clean -dxf
Setup the environment:
call "resources/scripts/set-compile-env-vs15-x86_64.bat"
Build installer:
cmake ../src/java-<num>-openjdk -G "NMake Makefiles"
nmake installer
Note: JDK Mission Control build files are NOT written to the <ojdkbuild>/build
directory where CMake is run, but to the <ojdkbuild>\upstream\jmc
directory. The following command may be used before the subsequent builds to ensure that JMC source directory is clean:
cd "upstream/jmc"
git clean -dxf
For some users it may be necessary to sign the produced native binaries (.exe
and .dll
) before packaging them into the MSI installer. It can be done the following way:
cmake .. <OPTIONS>
nmake installer_bundle
installer_bundle
target produces a <jdk>.installer_bundle.zip
file that contains all the installer contents and the XML descriptor. Binaries in this bundle can be signed using code-signing certificate.
After the signing, the following can be used to build the final MSI installer:
git clone https://github.com/ojdkbuild/tools_wix.git
cd <jdk>.installer_bundle
path\to\wix\bin\candle <jdk>.wxs
path\to\wix\bin\light -sw1076 -ext WixUIExtension -ext WixUtilExtension <jdk>.wixobj
To do a "slowdebug" build:
cmake ../src/java-<VERSION>-openjdk -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug
nmake zip_debug
After the build is configured and run once, OpenJDK can be rebuilt in "warm" mode:
call "resources/scripts/set-compile-env-<VERSION>.bat"
nmake devshell
devshell
target starts a Cygwin shell in the OpenJDK build directory:
uname -a
> CYGWIN_NT-6.2-WOW64 WIN-QBOE15UKBPJ 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin
Following OpenJDK make
targets can be run repeatedly in configured shell:
-
make
: default target that will buildexploded-image
-
make clean
: cleans all OpenJDK build artifacts (OpenJDK build dependencies that were built by thenmake
will be left intact) -
make images
: build OpenJDK and bundlejdk
image (this image lacks some dependency libs built by thenmake
) -
make all
: build jdk image and additionally generate apidocs for it
See details about the OpenJDK build in the building.md doc.