Buildling OpenJDK with Windows Subsystem for Linux
Thanks to Andrew Luo (and the JDK build team), it is now possible to build OpenJDK with Windows Subsystem for Linux on Windows 10 (1809+). This post will also use the JDK mirror at Github (if it is not synchronised, see the previous post for using Mercurial).
2019-01-19: added the Mercurial instructions
Activate Windows Subsystem for Linux
In an administrative Powershell:Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Restart then install, say, Ubuntu from the Windows Store
Then launch wsl and complete the inialisation.
See Microsoft documentation for the full instructionsCreate a C:\dev\ directory
Download OpenJDK 11 and extract it to C:\dev\jdk-11.0.1
Download and install Visual Studio 2017 Build Tools (when installing select the Visual C++ Build Tools, and ensure the language module is English (only))
In a WSL console select the following packages
sudo apt install autoconf
sudo apt install make
sudo apt install zip(unzip will be installed with zip)
Get OpenJDK’s source:
in a (cmd) console:cd C:\dev
git clone https://github.com/openjdk/jdk.gitor if it is not up to date:
hg clone http://hg.openjdk.java.net/jdk/jdk/
alternatively instead of attempting to clone from hg.openjdk.java.net (especially from Europe), download and extract Alexsey Shipilev’s https://builds.shipilev.net/workspaces/jdk-jdk.tar.xz then extract in C:\dev\jdk then
cd C:\dev
hg pull
hg updateBuild OpenJDK
in a (wsl) console:cd /mnt/c/dev/jdk
bash configure –with-boot-jdk=/mnt/c/dev/jdk-11.0.1/ –disable-warnings-as-errors
make images(–disable-warnings-as-errors so that VS2017 warnings are not stopping the build)
Test it
in a (cmd) console:C:\dev\jdk\build\windows-x86_64-server-release\images\jdk\bin\java –version
hack!
See the JDK’s building.md document for more information.