`
AnonymMan
  • 浏览: 22694 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Windows下以JRL源码构建Oracle JDK 6 update 23

    博客分类:
  • Java
阅读更多

之所以要重新编译Jdk的原因请参考:http://hllvm.group.iteye.com/group/topic/43576(非常感谢R大的解答),下面就说下在windows下编译SunJdk(OracleJdk)6u23的过程。

 

一:下载源码。

下载jdk-6u23-fcs-src-b05-jrl-12_nov_2010.jar、jdk-6u23-fcs-bin-b05-jrl-12_nov_2010.jar 

http://www.java.net/download/jdk6/6u23/promoted/b05/jdk-6u23-fcs-src-b05-jrl-12_nov_2010.jar

http://www.java.net/download/jdk6/6u23/promoted/b05/jdk-6u23-fcs-bin-b05-jrl-12_nov_2010.jar

下载完成之后分别执行

java -jar jdk-6u23-fcs-src-b05-jrl-12_nov_2010.jar

java -jarjdk-6u23-fcs-bin-b05-jrl-12_nov_2010.jar 

分别安装,然后合并到一起。

 

二:配置编译环境:

1、安装MicroSoft Visual Studio .NET 2003 Professional。下载地址:http://pan.baidu.com/s/1c0rPbFU

2、安装MicroSoft DirectX 9。下载地址:http://pan.baidu.com/s/1nPvbC

3、安装Microsoft Layer for Unicode (MSLU)。下载地址:http://www.microsoft.com/en-us/download/details.aspx?id=4237

4、安装cygwin,下载地址:http://cygwin.com/setup-x86_64.exe,安装CYGWIN时不能直接默认安装,因为表1-2中所示的工具都不会进行默认安装,但又是编译过程中需要的,因此要在图1-6的安装界面中进行手工选择。 

  表1-2 需要手工选择安装的CYGWIN工具 

文件名 分类 描述
ar.exe Devel binutils The GNU assembler, linker and binary utilities
make.exe Devel make The GNU version of the 'make' utility built for CYGWIN.
m4.exe Interpreters m4 GNU implementation of the traditional Unix macro processor
cpio.exe Utils cpio A program to manage archives of files
gawk.exe Utils awk Pattern-directed scanning and processing language
file.exe Utils file Determines file type using 'magic' numbers
zip.exe Archive zip Package and compress (archive) files
unzip.exe Archive unzip Extract compressed files in a ZIP archive
free.exe System procps Display amount of free and used memory in the system

 

注意:cygwin自带的make.exe的版本是4.0或者3.81,这两个版本在windows下会不识别C:,需要替换成make3.82版本。

 

下载地址:http://pan.baidu.com/s/1mgNwO6s 下载后重命名为make.exe替换%CYGWIN_HOME%/bin/make.exe

 

安装完毕之后将cygwin下的bin目录加入到PATH环境变量。

 

 5、下载freetype,下载地址:http://pan.baidu.com/s/1sjlsUvj

 

6、准备一个Bootstrap Jdk(SunJdk1.6即可)。

 

7、msvcrt.dll 下载地址:http://pan.baidu.com/s/1bnfFNVx

 

三:进行编译 

首先删除JAVA_HOME、CLASSPATH环境变量,然后执行%VS2003_HOME%/Vc7/bin/vcvars32.bat设置环境变量

注意:为了保险起见执行.bat文件后手动查看下PATH环境变量(我本机的如下):

C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\bin;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools\Bin;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin;C:\cygwin64\bin

确保PATH环境变量中cygwin的bin目录在vs2003后面。

做完这些之后开始正式编译:

打开cmd,执行以下命令(可以将下列命令copy到.bat文件下,dos下直接执行):

 

#你的Bootstrap Jdk的目录

set ALT_BOOTDIR=C:/jdk1.6.0_45

#你的Bootstrap Jdk的目录

set ALT_JDK_IMPORT_PATH=C:/jdk1.6.0_45

#你的freetype的include目录

set ALT_FREETYPE_HEADERS_PATH=C:/compileSunJdk6u23/freetype/include

#你的freetype的bin目录

set ALT_FREETYPE_LIB_PATH=C:/compileSunJdk6u23/freetype/bin

#你的MicrosoftDirectX9.0的目录

set ALT_DXSDK_PATH=C:/compileSunJdk6u23/MicrosoftDirectX9.0

#你的msvcrt.dll文件所在的目录

set ALT_MSVCRT_DLL_PATH=C:/compileSunJdk6u23/msvcr

#你的vc的编译器目录

set ALT_COMPILER_PATH=C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7/bin

#msdevtools的目录

set ALT_MSDEVTOOLS_PATH=C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Common7/Tools

#你的MicrosoftLayerForUnicode目录

set ALT_UNICOWS_DLL_PATH=C:/compileSunJdk6u23/MicrosoftLayerForUnicode

#你的MSVCDIR目录

set MSVCDIR=C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7

#设置INCLUDE

set INCLUDE=C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7/include;C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Include;C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include

#设置LIB

set LIB=C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7/lib;C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib;C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/lib

 

设置完这些环境变量之后输入bash命令进入bash下,然后cd 到%JDK_SOURCE_CODE_HOME%/control/make/下,检查下依赖的环境是否全部安装完毕:

 

make dev-sanity  BUILD_DEPLOY=false SKIP_COMPARE_IMAGES=true  HOTSPOT_BUILD_JOBS=6  COMPILER_VERSION=VS2003

 

如果检查没有问题的话会出现以下字样:

Sanity check passed.  

 

然后在执行最后的make命令之前,注意有两个坑:

1、需要将C:/Windows/System32/find.exe 暂时移动到其他目录下,避免与cygwin/bin/find.exe冲突,造成在编译过程中发生错误。

2、需要将将%VS2003_HOME%Common7\Tools\bin 中的rc.exe copy到 %VS2003_HOME%Common7\Tools下一份,因为在执行过程中发现

会报/bin/sh: C:/PROGRA~2/MICROS~2.NET/Common7/Tools/rc: No such file or directory的错误。

 

最后执行:

 

make dev  BUILD_DEPLOY=false SKIP_COMPARE_IMAGES=true  HOTSPOT_BUILD_JOBS=6  COMPILER_VERSION=VS2003

 

执行大概会消耗40分钟左右,耐心等待下。

 

 

 PS:在Linux下编译Oracle JDK6u23的话,请参考R大的http://rednaxelafx.iteye.com/blog/875957,本文算是对JRL源码构建OracleJDK6u23在windows上编译的一个补充。

 

 

 欢迎转载,请在转载时注明文章出处:http://anonymman.iteye.com/blog/2160370

 

 

 

 

 

 

 

 

 

1
1
分享到:
评论
1 楼 yjxa901 2017-06-27  
博主好:
http://www.java.net/download/jdk6/6u23/promoted/b05/jdk-6u23-fcs-src-b05-jrl-12_nov_2010.jar  这个下载地址已经失效了,能不能提供个下载地址,感激不尽,如果是jdk6u21就更好了,thanks a lot

相关推荐

Global site tag (gtag.js) - Google Analytics