Because OPENJDK is open source, this is done using OPENJDK to compile the link
Environmental requirements
- Centos6.7 64-bit
- Openjdk-7u40-fcs-src-b43-26_aug_2013.zip
- Bootstrap jdk:jdk1.6.0_38
Because we are compiled, so the environment can be adjusted according to their actual situation, JDK source package can go to this site to download https://jdk7.java.net/source.html
Boostrap JDK: Auxiliary jdk, which means that we need to build a new JDK to assist with the completion of the JDK, just as the ignition requires a lighter.
Pre-compilation preparation
You need to install the appropriate compilation tools because you want to compile
Yum install-y gcc gcc-c++
- Installing Cups-devel (Unix print system)
Yum Install-y cups-devel
- Installing Alsa-lib-devel
Yum Install-y alsa-lib-devel
- Installing the X Graphics library
Yum install-y libxrender libxrender-devel libxi-devel libxt-devel libxtst-devel
- Installing the FreeType Font Library
Yum install-y FreeType Freetype-devel
- Installing the bootstrap JDK
Yum install-y java-1.6.0-openjdk Java-1.6.0-openjdk-devel
Yum install-y Ant Ant-nodeps
Setting environment variables
Compiling the JDK differs by reading the configuration file to see what the user has done, instead of reading the current shell's environment variables to see the settings. You can refer to the following script when setting environment variables
Because we're going to study the Java Virtual machine, so here's the debug mode.
#!/bin/bash#ClearSettingsifYou have ever setup unset classpahtunset java_home#Selectlanguage, required export LANG=c#bootsrap JDK path installed, Requiredexport Alt_bootdir=/usr/local/jdk1.7. 0_79#setup Freetypeexport Alt_freetype_lib_path=/usr/local/Libexport Alt_freetype_headers_path=/usr/local/include
#setup Ant Pathexport ant_home=/root/apache-ant-1.9.7#dowload dependencies Automaticallyexport allow_downloads=ture#setup number of compiled threads same to Cpusexport hotspot_build_jobs=1Export Alt_parallel_compile_jobs=1Export Skip_compare_images=trueExport Use_precompiled_header=true#setup What's want to Compileexport Build_langtools=true#export Build_jaxp=false#export Build_jaxws=false#export Build_corba=falseExport Build_hotspot=trueExport BUILD_JDK=true#setup Arch= - ifYour CPU is -or arch= +Export Arch_data_model= -#setup version#export skip_debug_build=false#export Skip_fastdebug_build=true#export Debug_name=Debugbuild_deploy=false#cancel BuildInstallPackagebuild_install=false#setup output Direxport alt_outputdir=/usr/local/jdk7-dev/build
Note: Use the source command to execute the source setenv.sh when executing a script
Compile Environmental inspection
When we set the environment variable, if we see if our settings are correct
Enter the root directory of the source code, execute make sanity, if the result is as follows, the environment setting is successful
Compile
Execute make at the root of the source code to compile
Compiling JDK under CentOS