Compiling JDK under CentOS

Source: Internet
Author: User

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

    • Installing GCC, gcc-c++

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

    • Installing Ant

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.