Entries tagged [windows]
How to compile OpenJDK on Windows
by Sunny Chan
Posted on Sunday July 24, 2011 at 08:42pm in Java
These are the steps that I have made OpenJDK to compile on Windows platform:
- Install Visual C++ 2010 Express (or if you are rich, get Visual Studio 2010 Professional)
- Install Windows 7 Platform SDK
- Install Cygwin, install the packages suggested on OpenJDK Readme. Also install gcc for step 5
- Install DirectX 9.0 SDK
- The gnu make package in the current cygwin does not support Windows directory convention and you should compile your own version of the make 3.82 which has the correct support.
- Download latest Freetype.
- Compile it using Visual C++ - you can find the Visual C++ project file under <freetype src>/builds/win32/vc2010.
- Make sure you have change the type of DLL it generates by going to Project->Properties, then Configuration Manager... button, set it to Release and Win32
- Make sure you have set it so that it builds a DLL - you can find that under Project->Properties, Configuration Properties, General and there should be a Configuration Type drop down box
- You can then build freetype. The DLL generated will have a version number attached to it (e.g. freetype245.dll) and you will need to make sure you rename it to freetype.dll.
- Get latest Apache ANT
- Make sure you have a Java 6 JDK installed
- Download the openjdk source code, either using hg or source bundle (I will assume you put it in c:\openjdk)
- Open a command prompt for Windows SDK by going to Start -> Windows SDK 7.1 -> Windows SDK 7.1 command prompt
- For 32bit ONLY, you should run the Visual Studio compiler settings batch file: c:\program files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat
- Make sure you have override the standard cygwin bin path so that make.exe you have compiled in step 5 take precedent of the default cygwin.
- Also check that the link.exe you run in the path is the actual Microsoft linker and not the cygwin's link command - you will need to fiddle with the path.
- Setup a number of environment variables:
- ALT_BOOTDIR should point to the Java 6 JDK (Step 8)
- ALT_DXSDK_PATH is the DirectX SDK PATH (Step 4)
- ALT_FREETYPE_LIB_PATH and ALT_FREETYPE_HEADERS_PATH.
- ANT_HOME
- HOTSPOT_BUILD_JOBS if you want to parallelize your build - you can't use -j options in the make command
- ALLOW_DOWNLOADS=true so that it can download JAXP and JAXS jar
- Make sure the path is setup correctly (Step 12/13)
- You are ready to give it a go. First, run "make sanity" and see whether there is anything you setup incorrectly. If something is wrong, fix it.
- If you have passed make sanity, you can run make to build the JDK! Go and make a cuppa, it will take a while. On my i7-2600 and hard drive it took 2 hours.
Important: In order to build a 32bit JDK you must use a 32bit System - ie. you cannot cross compile (ie. 64bit Windows and compile a 32bit JDK)
Let me know whether it works for you. if it doesn't tell me what's wrong and I will fix the instructions!