Compile OpenJDK7 source code on CentOS6.5

Source: Internet
Author: User

This article address: http://www.cnblogs.com/wuyudong/p/build-openjdk7.html, reprint please indicate source address.

Using the open source version of OPENJDK, there are two ways to get its source code:

    • The Mercurial Code versioning tool takes the source directly from the repository, but is too slow to take several hours

    • Download the official packaged source package directly (recommended)

Download source Openjdk-7u6-fcs-src-b24-28_aug_2012.zip, unzip, as follows:

Http://www.java.net/download/openjdk/jdk7u6/promoted/b24/openjdk-7u6-fcs-src-b24-28_aug_2012.zip

This compilation uses a 64-bit OS and compiles 64-bit JDK, which requires at least 512MB of memory

1. Basic process

(Read the Readme and readme-builds.html)

The readme-builds.html contains detailed installation information, preferably a complete reading.

2. Install the base package

My centos6.5 is installed on VMWARE10 and installed with minimal (Minimal) installation

[Email protected] ~]# Cat/etc/redhat-releasecentos release 6.5 (Final) [[email protected] ~]# Uname-mx86_64[[email prote CTED] ~]# uname-r2.6.32-431.el6.x86_64

Configuring the update source

The current wget is not yet available.

#wget HTTP://MIRRORS.163.COM/.HELP/CENTOS6-BASE-163.REPOMV Centos-base.repo CENTOS-BASE.REPO.BAKMV Centos6-base-163.repo centos-base.repoyum makecacheyum-y groupinstall ' Base ' yum-y install make

To install the JDK Essentials package:

Yum-y Install alsa-lib-develyum-y Install cups-develyum-y install libxi-develyum-y install gcc gcc-c++yum-y install L ibx*

Upload or download related files to/application/tools

Mkdir-p/application/toolscd/application/tools

Upload or download the following related files to/application/tools

freetype-2.3.12.tar.gz:http://sourceforge.net/projects/freetype/files/freetype2/

Openjdk-7u6-fcs-src-b24-28_aug_2012.zip former article

apache-ant-1.7.1-bin.zip:http://archive.apache.org/dist/ant/binaries/

jdk-6u26-linux-x64.bin:http://www.oracle.com/technetwork/java/javase/downloads/ Java-archive-downloads-javase6-419409.html#jdk-6u26-oth-jpr

Compile and install FreeType:

TAR-XZF FREETYPE-2.3.12.TAR.GZCD freetype-2.3.12./configure Makemake Install

To install the JDK:

Unzip the Jdk-6u26-linux-i586.bin to the application/java/directory

Set the environment variables as follows:

#set java environmentjava_home=/application/java/jdkexport jre_home=/application/java/jdk/jreexport CLASSPATH=.:$ Java_home/lib: $JRE _home/lib: $CLASSPATHexport path= $JAVA _home/bin: $JRE _home/bin: $PATH

Install Ant:

Cd/application/tools/unzip Apache-ant-1.7.1-bin.zip ln-s/application/tools/apache-ant-1.7.1/bin/ant/usr/bin/ant

Check for Java and ant:

[[email protected] ~]# Java-versionjava version "1.6.0_26" Java (TM) SE Runtime Environment (build 1.6.0_26-b03) Java HOTSPO T (TM) 64-bit Server VM (build 20.1-b02, Mixed mode) [[email protected] ~]# AntBuildfile:build.xml does not exist! Build failed
3. Configuring variables
Nset classpathunset java_homeexport lang=cexport alt_bootdir=/application/java/jdkexport ANT_HOME=/application/ Tools/apache-ant-1.8.1/export Alt_freetype_lib_path=/usr/local/libexport Skip_debug_build=falseexport SKIP_ Fastdebug_build=trueexport Debug_name=debugexport Alt_freetype_headers_path=/usr/local/include/freetype2
4. Check whether the environment is configured OK and compile the JDK source code
[[Email protected] tools]# CD Openjdk[[email protected] openjdk]# Pwd/application/tools/openjdk[[email protected] openjdk]# Make Sanity

......

openjdk-specific Settings:
Freetype_headers_path =/usr/local/include/freetype2
Alt_freetype_headers_path =/usr/local/include/freetype2
Freetype_lib_path =/usr/local/lib
Alt_freetype_lib_path =/usr/local/lib

Previous JDK Settings:
Previous_release_path = Using-previous_release_image
Alt_previous_release_path =
previous_jdk_version = 1.6.0
alt_previous_jdk_version =
Previous_jdk_file =
Alt_previous_jdk_file =
Previous_jre_file =
Alt_previous_jre_file =
previous_release_image =/application/java/jdk
alt_previous_release_image =


Sanity check passed.

Execute the following command:

[[email protected] openjdk]# make all

Build Times----------
Target Debug_build
Start 2015-05-05 09:34:37
End 2015-05-05 10:24:33
00:05:23 CORBA
00:10:49 hotspot
00:00:55 JAXP
00:01:07 Jaxws
00:30:05 JDK
00:01:36 Langtools
00:49:56 Total
-------------------------
MAKE[1]: Leaving directory '/APPLICATION/TOOLS/OPENJDK '

View results:

[Email protected] openjdk]#  ./build/linux-amd64/bin/java-version

OPENJDK Version "1.7.0-internal-debug"
OpenJDK Runtime Environment (build 1.7.0-internal-debug-root_2015_05_05_09_15-b00)
OpenJDK 64-bit Server VM (build 23.2-b09-jvmg, Mixed mode)

Resources

"Deep Java Virtual machine"

Compile OpenJDK7 source code on CentOS6.5

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.