본문 바로가기

Academy I/Tech Academy

Building OpenJDK on Windows with NetBeans

Building OpenJDK on Windows with NetBeans

Poonam Parhar
Consulting Member of Technical Staff
Trying to build OpenJDK on Windows ? Here are some simple steps that may help...
Here are the softwares required for the build.
- Download OpenJDK from http://download.java.net/openjdk/jdk7/ and unzip the contents
- Download and install jdk 6.0 from http://java.sun.com/javase/downloads/index.jsp and jdk 7.0 from http://download.java.net/jdk7/binaries
- Download and install openjdk binary plugs from http://download.java.net/openjdk/jdk7/
- Install Microsoft Visual Studio .NET 2003 Professional
- Install Cygwin from http://www.cygwin.com. Make sure you install it in dos/text mode. Along with the default installation, we need to install Devel, Interpreters and Utils pakages. For the build, we need make 3.80, so if the cygwin make in not 3.80, download make bundle from http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2 and untar it in a separate folder.
- Download and install findbugs from http://findbugs.sourceforge.net/downloads.html.
- Download and install Ant from http://ant.apache.org/bindownload.cgi
- Install Microsoft DirectX 9.0 SDK
- Download and install Microsoft Unicode library
- Install Freetype 2.3.4 from http://sourceforge.net/project/showfiles.php?group_id=3157
- Install NetBeans 6.0 from http://www.netbeans.org/downloads/

To build OpenJDK with NetBeans, open 'jdk' project in openjdk/jdk/make/netbeans/ with NetBeans. But first open a command window (cmd.exe) and set the path for following installed softwares:
set PATH=d:/utilities/usr/bin;d:\\devtools\\cygwin\\bin;D:\\devtools\\findbugs-1.3.0\\bin;
D:\\devtools\\apache-ant-1.7.0\\bin;%PATH%
Here, d:/utilities/usr/bin contains make 3.80. Also, it is setting the path for cygwin, FindBugs and ant.
then run vsvars32.bat of Microsoft Visual Studio .NET:
d:\\Progra~1\\Micros~1.NET\\Common7\\Tools\\vsvars32.bat
Now launch Netbeans from this command window.
In Netbeans, click on File->Open Project. Browse to openjdk/jdk/make/netbeans/ and select 'jdk'.
In openjdk/jdk/make/netbeans/common/make.xml file, change the location of bin/make to your 3.80 make.
<target name="-pre-init.windows" if="os.windows">
<property name="platform" value="windows"/>
<property name="make" value="d:/utilities/usr/bin/make"/>
</target>
In build.properties file, set the following environment variables:
bootstrap.jdk=d:/devtools/jdk1.7.0
make.options=\\
ALT_BOOTDIR=D:/Java/jdk1.6.0_03 \\
ALT_BINARY_PLUGS_PATH=D:/devtools/openjdk-binary-plugs \\
ALT_JDK_IMPORT_PATH=d:/devtools/jdk1.7.0 \\
ALT_DXSDK_PATH=d:/devtools/dxsdk9 \\
ALT_COMPILER_PATH=D:/Progra~1/Micros~1.NET/Vc7/bin \\
ALT_MSDEVTOOLS_PATH= D:/Progra~1/Micros~1.NET/Common7/Tools/Bin \\
ALT_MSVCR71_DLL_PATH= D:/Progra~1/Micros~1.NET/SDK/v1.1/Bin \\
ALT_FREETYPE_LIB_PATH=d:/devtools/freetype-2.3.4/lib \\
ALT_FREETYPE_HEADERS_PATH=d:/devtools/freetype-2.3.4/include \\
ALT_UNICOWS_LIB_PATH=d:/devtools/unicows \\
ALT_UNICOWS_DLL_PATH=d:/devtools/unicows \\
LD_LIBRARY_PATH= \\
CLASSPATH= \\
JAVA_HOME= \\
SHLVL=1 \\
OPENJDK=true
And that's all we need to do. Start the build (press F11 or right click on jdk project and click Build)




OpenJDK unofficial installers for Windows, Linux and Mac OS X

###Project discontinued

This project is discontinued.

Up-to-date OpenJDK 8 binaries for Windows x86_64 are available in ojdkbuild GitHub project.

Some details can be found in this issue about jdk8.

###OpenJDK 7 update 80 build 32

Older downloads may be found at the bottom of the page.

###Mailing list

For questions about these builds you may use the mailing list:

  • list address: openjdk-unofficial-builds@googlegroups.com
  • subscribe address: openjdk-unofficial-builds+subscribe@googlegroups.com
  • archives: link

###Other OpenJDK builds



Downloads for Windows x86_64

Note: obsolete downloads are available at the bottom of this page.

Other downloads

Windows x86 (issue)

Windows and Linux OpenJDK 8 x86_64 with JVMCI support (for GraalVM)

Linux x86_64 (details)

Linux ARM32



Downloads description

Note: description represents information about current builds (on the top of the page). For previous builds (at the bottom of the page) please see description, linked near them

###Source code

OpenJDK 7 binaries were built from the jdk7u80-b32 of official OpenJDK 7 Update Releases repositories forest.

###Build platforms

OpenJDK project has "minimum build environments" (MBE) that should generate most-compatible binaries - OpenJDK7 MBE, Mac OS X MBE.

Build environments used for OpenJDK7:

  • windows-i586: Windows XP SP3 and Windows 7.1 SDK (MBE - 7.1 SDK has the same compilers as VS2010)
  • windows-amd64: Windows Server 2003 Enterprise x64 Edition and Windows 7.1 SDK (MBE)
  • macosx-x86_64: Mac OS X 10.7.5 Lion and XCode 4.3.2 (GCC 4.2.1) (almost MBE, 10.7.5 instead of 10.7.3)
  • linux-i586: Debian 5.0 Lenny and GCC 4.3.2 (MBE)
  • linux-amd64: Debian 5.0 Lenny and GCC 4.3.2 (MBE)

###FreeType

On Linux and Mac OS X system prebuilt freetype libraries are used. On windows, libraries (.dll and .lib) were built from version 2.5.3 as release-multithreaded using the same compilers as openjdk itself.

Simple header patch was applied for all builds.

###CA certificates

OpenJDK source code contains empty cacerts file, that may cause troubles working with HTTPS (trustAnchors error). These builds contain cacerts file generated with script from obuildfactory project.

###Unlimited cryptography

All builds use unlimited cryptography by default.

###JavaScript support

OpenJDK supports scripting languages through JSR 223 specification. But Mozilla Rhino is not a part of OpenJDK and these builds don't bundle out-the-box implementation for "JavaScript" engine for javax.script. To use JavaScript with these builds please see this issue for details.

###Debug symbols

Debug builds are included as additional downloads for all "zip" and "bundle" downloads. They contain debug symbols for native binaries and for java classes. See this issue for additional info.

Mac OS X builds do not support native debug symbols - bug entry, additional info.

For OpenJDK6 all Windows builds contain native debug symbols and all Linux builds does not contain ones. Classfiles debug symbols are included in all -debug-image builds.

###Installers

Installers were built using IzPack installer. Installers contain JDK files (JRE may be installed separately) and uninstallers. Installers for all platforms contain exactly the same content: jre directory, izpack's install.jar and install executable launcher. With default settings installers do not require administrator privileges.

Installers may add JAVA_HOME environment variable and adjust user PATH variable on all platforms. On Windows global PATH variable and Windows Registry are also supported (see this issue) but may require administrator privileges.

###Native launchers

install and uninstall native launchers (with .exe on windows) were built using jar-launcher. They run install.jar and uninstall.jar using bundled JRE.

###Zip images

ZIP downloads (*-image.zip files) contain zipped JDK files (contents of j2sdk-server-image).

###Mac OS X application bundle

Mac OS X downloads additionally contain application bundle (*-bundle.zip) and installation script for local user install.

###Fonts

DejaVu fonts are included with all builds.

###Malware threats

All builds are checked with antivirus software before publishing. I also recommend building them yourself for safety.

Build Process (manual builds)

###Linux and Mac OS X builds

Linux and Mac builds are quite easy:

  • install build dependencies on your linux or mac box
  • download cacerts and rhino jar from this project
  • set environment variables base on build-linux-* or build-macosx-x86_64.sh files (comment out script launch at the bottom)
  • go to openjdk sources root and run make

###Windows builds

Windows build is more comlicated than linux and mac ones. It is described in official build doc.

This git repository contains tools, libraries and build environment .bat scripts.

Microsoft compiler toolchains and DirectX SDK cannot be distributed on github because of legal reasons, so some prerequisites installation required.

####DirectX libraries

Microsoft DirectX 9.0 SDK (Summer 2004) is used in all windows builds. It was available on microsoft.com (I've dowload it there in November 2012), but it may be not available now. It may be found online on other sites. File details:

  • name: dxsdk_sum2004.exe
  • size: 239008008
  • sha1: 73d875b97591f48707c38ec0dbc63982ff45c661

After installation DirectX files should be put into libs/directx directory, files list.

####Microsoft compilers

OpenJDK7 i586 builds should work on 32-bit Windows XP and later, amd64 builds - on 64-bit Windows 2003 and later.

Both i586 and amd64 versions of OpenJDK7 may be built using the same Windows 7.1 SDK (you'll need some additional files for amd64). SDK files should be copied into utils/winsdk71 and may be used as standalone toolchain on completely clean windows box:

  • install Windows SDK 7.1 for x86_32, available at microsoft.com, GRMSDK_EN_DVD.iso file, sha1: cde254e83677c34c8fd509d6b733c32002fe3572
  • install Windows SDK 7.1 for x86_64, the same link as above, GRMSDKX_EN_DVD.iso file, sha1: 9203529f5f70d556a60c37f118a95214e6d10b5a on another x64 windows box
  • copy Visual Studio files (shipped with SDK) to utils/winsdk71/vs2010e, files list
  • copy SDK x86_32 files to utils/winsdk71/sdk, files list
  • copy Bin/x64 directory from SDK x64 installation to utils/utils/winsdk71/sdk/Bin/x64

####JDK7 compiler

JDK7 is required to build OpenJDK7 with IcedTea patches. OpenJDK version or Oracle one should be installed.

####Run build

  • adjust build-windows-* script - remove make-and-bundle.sh launch at the bottom, uncomment simple bash launch
  • launch build-windows-* script
  • cd to openjdk7 sources root
  • run chmod -R 777 . to fix source files permissions (not always required, see this thread)
  • run make

###Create installer

To create IzPack installer for newly built j2sdk-server-image run this command from the same Cygwin console:

openjdk-unofficial-builds/installer/build-installer.sh path/to/openjdk_sources_root

You may edit IzPack installer descriptor and attendant files for corresponding platform in installer/<platform> directory.

izpack-launcher wrapper is used to launch Izpack installer build. IzPack standalone compiler also may be used without this wrapper.

Build Process (auto builds)

Note: auto build setup is complex, if you have troubles with it, please write to mailing list.

###Host environment

Linux or mac should be used as a host:

  • create user obf
  • setup virtualbox bridged network interface
  • download host files
  • download and setup ssh keys from build factory
  • copy openjdk sources to host directory as openjdk.zip
  • copy this project sources to host directory as oub.zip (directx and microsoft compilers should be added to source tree beforehand, as listed above)

###Virtual machines

Note: it may be not legal to use Mac OS X guest on non-mac hosts - SO link

  • install OS into VirtualBox machine using IDE virtual controller
  • create user obf
  • windows only: enable auto-login for obf user: 1, 2, 3, 4
  • windows only: download build factory files into c:\obf and run bootstrap.bat - SSH server (copssh GPL), and obf_build windows service will be set up
  • linux/mac only: install build dependencies as listed above
  • linux/mac only: install OpenSSH and setup ssh keys from build factory
  • ensure that now under obf user you can ssh into guest and into host back as ssh <address> without usernames and passwords
  • upload jdk7 into guest as /home/obf/jdk7 (c:\obf\jdk7 on windows)
  • put prepared virtual machine hard disks into machines directory as xz archive

###Run build

To run build for a single platform use:

. jdk7-<platform>.env
./build.sh

Live build output will be written to build.log.

To run build for a multiple platform use:

./start.sh

Output also will be tailed to console.

Distributions will be placed into dist host directory.

###Build process under the hood

  • decompress VM image
  • create VirtualBox VM over unpacked image and run guest instance
  • copy over SCP openjdk.zip and oub.zip to guest and decompress them
  • attach logger to host's build.log over SSH
  • run build as windows service in windows or using nohup in mac/linux
  • check guest build flag file periodically
  • on "buid success" flag copy binaries to host, shutdown and deregister VM, start build for the next guest image
  • on "build flag" flag abort the script leaving guest running for error diagnostics

License information

OpenJDK binaries are released under the GNU GPL v. 2 with classpath exception.

Build scipts have been written by me, they are released under the Apache License 2.0.

Other sources and binaries in this repository (cygwin, freetype etc.) are released under their corresponding licenses.