编译JDK8历史版本

参考资料

工具准备

cygwin

使用支持winxp的版本

1
setup-x86.exe --allow-unsupported-windows --site http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2016/08/30/104223 --no-verify

必备工具命令

  • git
  • wget
  • unzip
  • zip
  • cpio
  • make
  • gcc-g++

git

  • 关闭crlf转换
  • VisualStudio仅使用英文

OpenJDK

根据需要找到版本号,如 jdk8u121-b36 https://hg.openjdk.java.net/jdk8u/monojdk8u/rev/8b0e3c5074f2

构建

配置

1
2
# bash configure --help 查看所有可用参数
./configure --with-boot-jdk=/cygdrive/c/App/Java/jdk1.7.0_80 --with-freetype=/cygdrive/c/App/freetype2 --with-jvm-variants=client --with-debug-level=fastdebug

编译

1
make CONF= all

报错处理

  • Could not initialize class sun.font.SunFontManager

跟随jdk编译出的freetype2有问题,可以自己下载源码编译并在jdk编译时指定;

  • 不能使用GnuWin32的freetype2
1
2
3
4
5
6
7
8
9
10
最终通过下载 
https://sourceforge.net/projects/freetype/files/freetype2/2.13.0/
并在WinXP上使用vs2010编译,将产物放到指定目录即可(jdk编译指定的freetype目录有格式要求)

-- include
---- freetype
---- ft2build.h
-- lib
---- freetype.dll
---- freetype.lib
  • the trustAnchors parameter must be non-empty

参考 https://www.baeldung.com/java-trustanchors-parameter-must-be-non-empty

默认编译出来的jdk是缺少一些证书,这里可以简单从已有的jdk中复制来解决

比如从 jdk1.8.0_121的 java/security 覆盖