Problem with Windows build - freetype.dll: %1 is not a valid Win32 application

Magnus Ihse Bursie magnus.ihse.bursie at
Fri Jan 23 12:10:27 UTC 2015

On 2015-01-19 09:39, Mads Bondo Dydensborg wrote:
> Hi there
> As written about earlier, I have compiled OpenJDK on Windows 7 64 bit, using Visual Studio 2010 Express SP 1, under Cygwin. (eventually: make clean images). AFAIK, VS Express will only build a 32 bit image, and has done. A simple HelloWorld test seems to work. However, if I try to run anything graphical, I get a linker error regarding Freetype:
> mbd at LT01666 ~/Compile/openjdk-8-src-b132-03_mar_2014/openjdk/build/windows-x86-normal-server-release/images/j2sdk-image/demo/jfc/FileChooserDemo
> $ ../../../bin/java.exe -jar FileChooserDemo.jar
> jan. 19, 2015 8:39:41 AM FileChooserDemo main
> SEVERE: null
> java.lang.reflect.InvocationTargetException
>          at java.awt.EventQueue.invokeAndWait(
>          at java.awt.EventQueue.invokeAndWait(
>          at javax.swing.SwingUtilities.invokeAndWait(
>          at FileChooserDemo.main(
> Caused by: java.lang.UnsatisfiedLinkError: C:\apps\cygwin\home\mbd\Compile\openjdk-8-src-b132-03_mar_2014\openjdk\build\windows-x86-normal-server-release\images\j2sdk-image\jre\bin\freetype.dll: %1 is not a valid Win32 application
>          at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> ....(lots of FontManager => ClassLoader$NativeLibrary stuff).
> I am a bit new to Windows, but checking the lib in question:
> mbd at LT01666 ~/Compile/openjdk-8-src-b132-03_mar_2014/openjdk/build/windows-x86-normal-server-release/images/j2sdk-image/jre/bin
> $ file freetype.dll
> freetype.dll: current ar archive
> mbd at LT01666 ~/Compile/openjdk-8-src-b132-03_mar_2014/openjdk/build/windows-x86-normal-server-release/images/j2sdk-image/jre/bin
> $ ldd freetype.dll
>          ntdll.dll => /cygdrive/c/windows/SysWOW64/ntdll.dll (0x77e70000)
>          kernel32.dll => /cygdrive/c/windows/syswow64/kernel32.dll (0x75900000)
>          KERNELBASE.dll => /cygdrive/c/windows/syswow64/KERNELBASE.dll (0x75a10000)
> I am not sure if it is 32 or 64 bit, really...
> As part of the build process, I had to create a copy of freetype.dll.a - this was installed in the X86 part of the Windows Program Files directory - I assumed that it was 32 bit.
> Any help/hints much appreciated.

Freetype on Windows has long been a frustrating source of problems.

In JDK9 there is a new configure option, --with-freetype-src, which 
helps out a lot with the problematic freetype on Windows. It just 
requires you to download the freetype source code and it will 
automatically compile a correct freetype library for use by OpenJDK.

AFAIK this patch has not been backported to JDK8, however. But if you 
can switch to JDK9 I highly recommend  it. An alternative solution might 
be to download JDK9 just to use this feature, and then point to the 
newly built freetype library using configure in JDK8.


More information about the build-dev mailing list