- Building OpenJDK on Windows
- Windows SDK for Windows 7.1
- Microsoft VisualC++ 2010 Express
- Cygwin (64 bit)
- freetype
- Hg/Ant/JDK7
- Getting OpenJDK sources
- Configure
- Build it
- How to download and install prebuilt OpenJDK packages
- JDK 9 & Later
- JDK 8
- Debian, Ubuntu, etc.
- Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
- JDK 7
- Debian, Ubuntu, etc.
- Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
- JDK 6
- Debian, Ubuntu, etc.
- Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
- BSD Port
- Microsoft Build of OpenJDK ™
- Java ™ at Microsoft
- OpenJDK 11 Preview
- OpenJDK 16 EA for Windows AArch64 / ARM64
- Feedback
- How to install OpenJDK 11 on Windows?
- 7 Answers 7
- Building OpenJDK8 on Windows x64
Building OpenJDK on Windows
Tomorrow I’ll be enjoying an OpenJDK hack session with Martijn Verburg (aka The Diabolical Developer). To prepare for this session he told us to follow the AdoptOpenJDK build instructions.
Most cool developers today seem to be using OS/X, but some of us are stuck on Windows laptops. I actually choose to stick with Windows 7 because every single client I’ve worked for has Windows workstations and only require the application to run on Windows. But anyway Martijn said: “Getting OpenJDK to build on Linux/Mac would be easy, Windows can be dicey”
With a bit of Googling and some small problems I’ve got it working just fine on my Windows 7 (64 bit). Most information I got was from this write-up, but I encountered some problems and could skip some steps I didn’t need.
All the tools mentioned are free, but you will have to install some Microsoft Visual C++ packages to compile (which most Java programmers try to avoid).
Windows SDK for Windows 7.1
Instead of the blogpost above mentioning this step second, I recommend doing it first. If you install VisualC++ 2010 Express first this step might fail with some weird error. The solution? Uninstall VisualC++ 2010 Express and first install Windows SDK for Windows 7.1.
Microsoft VisualC++ 2010 Express
Cygwin (64 bit)
For some reason I ran into problems early on using the 64 bit Cygwin, so I decided to install the 64 bit version as well. This worked, so I recommend doing this.
During the installation you’ll need to add some development packages:
I might have forgotten one or two, this will probably popup during the ‘configure’ step below. If you find a missing package, please tell me and I’ll update the post.
The version of ‘make’ that is packaged with Cygwin doesn’t work with OpenJDK. Instead we need to download the source from http://ftp.gnu.org/gnu/make/. I picked version 3.82 (this one is mentioned on the OpenJDK page). I downloaded and unzipped the source code here: C:\Projects\OpenJDK\make-3-82
To compile, fire up Cygwin and type:
Now you could take the generated ‘make.exe’ and place it into the Cygwin bin directory, but this isn’t needed.
freetype
Next we need to have Freetype, this step is done exacly like descriped here. Only do the ‘Freetype’ chapter generating the lib and dll.
Once you’ve generated the lib+dll, make a new directory (I used C:\Projects\OpenJDK\freetype). Add the ‘include’ directory from the freetype source code used in the step before. Also create a ‘lib’ directory and place the generated lib and dll in it.
Hg/Ant/JDK7
The other article mentions you’ll need to install TortoiseHg, Apache Ant and a current JDK 7 (as bootstrap). I didn’t have to do this because I already had all three installed. But please go ahead, they are probably needed:
Getting OpenJDK sources
The other article mentions a lot of PATH requirements that need to be set. I didn’t encounter this at all because I configured my build in another way. First we’ll need to get the OpenJDK source code.
This will create a new directory: /cygdrive/C/Projects/OpenJDK/jdk8_tl with all the sources!
Configure
Now we need to configure a build for OpenJDK. Instead of just calling ‘./configure’ we’ll need to add a few extra options, we’ll need to point it to the correct MAKE directory and we need to include our custom build freetype.
This will throw a lot of warnings, but in the end it should print something like this:
After the configure step you should have a new build directory added.
Mine was located at: /cygdrive/C/Projects/OpenJDK/jdk8_tl/build/windows-x86_64-normal-server-release
Build it
The next thing I did was to build everything, this can take anywhere from 10 to 40 minutes, my build took 20 minutes.
After a long wait and a lot of warnings and messages it says it created your very own JDK 8 build. Time to give it a try:
It worked!
Like I said before, I encountered some problems and errors along the way. Most involved the wrong Cygwin (32 bit), this caused bash to crash (STATUS_ACCESS_VIOLATION) during the configure phase. Also I ran into a problem installing ‘Microsoft SDK for Windows 7.1’ which required me to first uninstall Microsoft VisualC++ 2010. Another problem was not installing ‘diff’ in Cygwin (diffutils) so the build found some other diff.exe (from Git?) which gave differences during the actual build causing it to stop.
I might have forgotten to write down some step, if you encounter any problem (and solve them) please tell me so I can update this post!
One thing I should add is ‘ccache’. This tool greatly improves the build speed because it caches all unchanged classes/files. It was in Cygwin (32 bit) but it is missing in Cygwin (64 bit)… I’ll have to compile and install it myself. This is one thing I haven’t tried yet, but I probably should do!
Update: I’ve tried compiling and using ccache-3.1.9, but this broke the build. I might try different versions but for now I’ll just skip ‘clean’-ing altogether 🙂
How to download and install prebuilt OpenJDK packages
JDK 9 & Later
Oracle’s OpenJDK JDK binaries for Windows, macOS, and Linux are available on release-specific pages of jdk.java.net as .tar.gz or .zip archives.
As an example, the archives for JDK 13 may be found on jdk.java.net/13 and may be extracted on the command line using
depending on the archive type.
JDK 8
Debian, Ubuntu, etc.
On the command line, type:
The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.
JDK 7
Debian, Ubuntu, etc.
On the command line, type:
The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package.
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
The java-1.7.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.7.0-openjdk-devel package.
JDK 6
Debian, Ubuntu, etc.
On the command line, type:
The openjdk-6-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-6-jdk package.
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
The java-1.6.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.6.0-openjdk-devel package.
BSD Port
For a list of pointers to packages of the BSD Port for DragonFly BSD, FreeBSD, Mac OS X, NetBSD and OpenBSD, please see the BSD porting Project’s wiki page.
Microsoft Build of OpenJDK ™
Free. Open Source. Freshly Brewed!
Supported on macOS, Linux, and Windows.
Java ™ at Microsoft
Java at Microsoft spans from Azure to Minecraft, across SQL Server to Visual Studio Code, and beyond! We use more Java than one can imagine.
The Microsoft Build of OpenJDK is a new no-cost long-term supported distribution and Microsoft’s new way to collaborate and contribute to the Java ecosystem.
OpenJDK 11 Preview
This is a preview release, we do not recommend its use in production environments.
Platform | Type | Download Link | Checksum (SHA256) | Sig File |
---|---|---|---|---|
Linux x64 | tar.gz | microsoft-jdk-11.0.10.9-linux-x64.tar.gz | ac61525bcc693fff2a69070b363ee8789942206b7b840849b307b6997d017001 | Download |
Linux x64 | debugsymbols | microsoft-debugsymbols-11.0.10.9-linux-x64.tar.gz | aaee3908e437eeada52163d59ce6f377cea81edb713c8f1121a1a8451620abdb | n/a |
macOS x64 | tar.gz | microsoft-jdk-11.0.10.9-macos-x64.tar.gz | 2e97bd29ca204d7bbaf26b8c648b1d529a0339e396b1f27a71281d05fb75ab3c | Download |
macOS x64 | pkg | microsoft-jdk-11.0.10.9-macos-x64.pkg | f74bbe4ae3aae6f80128471f3f38e66b176625c752341c642a6fc245bcf93abd | n/a |
macOS x64 | debugsymbols | microsoft-debugsymbols-11.0.10.9-macos-x64.tar.gz | 6bf62cab8ef689c75f6c792c0c5c6e765a57dbd848948a8205b66233ffb94f0d | n/a |
Windows x64 | zip | microsoft-jdk-11.0.10.9-windows-x64.zip | 3691b74398977965e894ae51c92890c4894a5548606e503d15c88c6b77840797 | Download |
Windows x64 | msi | microsoft-jdk-11.0.10.9-windows-x64.msi | 4f9f6c9cd1cc9f1d6d893e59dd74ffc7711892cade528937cd3acb12e2b2dc5b | n/a |
Windows x64 | debugsymbols | microsoft-debugsymbols-11.0.10.9-windows-x64.zip | 106e391f5a43a004729daf65331df9f000bc2062328935a0872dfef4be2affcb | n/a |
All | sourcecode | jdk11u.tar.gz | 7b873a9c00bb66025e7810750bae7785761406f41623a76d8d08ab42865d9c08 | n/a |
The public key to verify the SIGNATURE file can be downloaded here.
Other Downloads
Linux Packages (RPM and DEB files) are available at packages.microsoft.com.
Please see the Linux Installer guide for how to get started.
Container Images
Container images are coming soon
Release Notes
Microsoft Specific Enhancements:
OpenJDK 16 EA for Windows AArch64 / ARM64
This is an early-access release, we do not recommend its use in production environments.
Platform | Type | Download Link | Checksum (SHA256) | Sig File |
---|---|---|---|---|
Windows AArch64 / ARM64 | zip | microsoft-jdk-16.36-windows-aarch64.zip | 48dc4aa4b992c721f29ffae104dc71455a7ac3082336a0a77570eba67876e601 | Download |
Windows AArch64 / ARM64 | debugsymbols | microsoft-debugsymbols-16.36-windows-aarch64.zip | ef392977f25a7b4d79f490f25ba155ed7ebb3942fb6c0798c26833b1b8441000 | n/a |
All | sourcecode | jdk16u.tar.gz | 93ce379933bf820fe7799fadebbc7376479c9c0918a0ddcccf64f2c3798e2980 | n/a |
The public key to verify the SIGNATURE file can be downloaded here.
Feedback
Please do send us your comments, thoughts, and ideas to help us improve this. Visit our GitHub page to send us your feedback.
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
How to install OpenJDK 11 on Windows?
In the past, Oracle used to publish an executable installers for Windows that would:
- Unpack files
- Add registry keys indicating the installed version and path
- Add the JRE to the system PATH
- Register an uninstaller with Windows.
As of Java 11, the Oracle’s free version of Java (Oracle OpenJDK) doesn’t seem to include an installer. It is just a zip file containing the binaries.
How are we supposed to install OpenJDK 11 on Windows seeing as the aforementioned integrations are no longer there? Aren’t they necessary?
7 Answers 7
Extract the zip file into a folder, e.g. C:\Program Files\Java\ and it will create a jdk-11 folder (where the bin folder is a direct sub-folder). You may need Administrator privileges to extract the zip file to this location.
- Select Control Panel and then System.
- Click Advanced and then Environment Variables.
- Add the location of the bin folder of the JDK installation to the PATH variable in System Variables.
- The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;»C:\Program Files\Java\jdk-11\bin»
- Under System Variables, click New.
- Enter the variable name as JAVA_HOME.
- Enter the variable value as the installation path of the JDK (without the bin sub-folder).
- Click OK.
- Click Apply Changes.
To see if it worked, open up the Command Prompt and type java -version and see if it prints your newly installed JDK.
If you want to uninstall — just undo the above steps.
Note: You can also point JAVA_HOME to the folder of your JDK installations and then set the PATH variable to %JAVA_HOME%\bin . So when you want to change the JDK you change only the JAVA_HOME variable and leave PATH as it is.
Building OpenJDK8 on Windows x64
so I am trying to compile openjdk8 from sources, but I am stuck at missing files problem in the end of compilation process.
Here is the software that I use:
- Windows 7 SP1 x64
- Windows SDK for Windows 7.1
- Microsoft .NET Framework 4
- Visual Studio 2010 Express Edition
- GNU make 3.82 (compiled by myself)
- Freetype 2.3 (compiled by myself)
- Oracle JDK 1.7 update 71
- Direct X 9.0 (August 2009)
- Cygwin
Here are the manuals which I was reading from:
With all these guides I am able to let it compile, however during the Building Images — step , I get an error that some files are missing ( and they are indeed missing ) , which makes me think that something has gone wrong during the build.
There are several points where I afraid I might be doing something wrong.
Right now I use cygwin version 2.8. The openjdk configure script requires cygwin version >1.7 but fails to recognize that 2.8 is greater than 1.7 and throws me an error, so i’ve tweaked the script (made build work like 2 months ago).
My configure command looks as follows:
./configure —disable-ccache —with-freetype=/cygdrive/c/freetype
Maybe I need more arguments here to make it work ( note that i’ve copied self compiled make executable to cygwin bin folder, so that i dont need to provide its location )
- Visual Studio C++ 2010 Express
I would rather try Professional Trial version, but it cannot be found anywhere anymore. (except torrents. ) I have a strong feeling that Express version is not suitable for openjdk build. I also get that error with missing ammintrin.h file, but it is easily resolved by creating the empty header file in the include folder of Visual Studio installation.
My basic procedure of building is:
- Install all the software above
- hg clone http://hg.openjdk.java.net/jdk8/jdk8
- ./get_source.sh
- ./configure —disable-ccache —with-freetype=/cygdrive/c/freetype`
- make clean images
However, here how it ends :
Does anyone have any clue of how to solve this?