Home >Operation and Maintenance >Linux Operation and Maintenance >Detailed steps for compiling JDK in Linux environment

Detailed steps for compiling JDK in Linux environment

不言
不言forward
2019-03-12 15:29:523836browse

The content of this article is about the detailed steps of compiling JDK in Linux environment. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Environment preparation

  1. Operating system, ubuntu-14.04.6-desktop-amd64.iso, download address: http://59.80.44.100/releases.ubuntu. com/14.04/ubuntu-14.04.6-desktop-amd64.iso.
  2. Open JDK source code, openjdk-7u75-src-b13-18_dec_2014.zip, download address: https://download.java.net/openjdk/jdk7u75/ri/openjdk-7u75 -src-b13-18_dec_2014.zip
  3. Bootstrap JDK, use Oracle JDK: jdk-6u45-linux-x64.bin, download address: https://www.oracle.com/ technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html

##Compilation steps

1. Install JDK compilation dependencies and execute the command:

sudo apt-get install build-essential gawk m4 libasound2-dev libcups2-dev libxrender-dev xorg-dev xutils-dev x11proto-print-dev binutils libmotif3 libmotif-dev ant

2. Unzip Open JDK.

unzip openjdk-7u75-src-b13-18_dec_2014.zip

3. Install Bootstrap JDK.

./jdk-6u45-linux-x64.bin

4. Create a new shell script in the Open JDK directory: build.sh, d573945737aa889c598e1fbb9059fea6/build.sh. The script content is as follows:

#!/bin/bash 
export LANG=C 
export ALT_BOOTDIR=/home/javon/jdk/jdk1.6.0_45

#允许自动下载依赖包 
export ALLOW_DOWNLOADS=true#使用预编译头文件,以提升便以速度 
export USE_PRECOMPILED_HEADER=true#要编译的内容 
export BUILD_LANGTOOLS=true export BUILD_JAXP=true export BUILD_JAXWS=true export BUILD_CORBA=true export BUILD_HOSTPOT=true export BUILD_JDK=true#要编译的版本 
export SKIP_DEBUG_BUILD=false export SKIP_FASTDEBUG_BUILD=true export DEBUG_NAME=debug

#避免javaws和浏览器Java插件等的build 
BUILD_DEPLOY=false#不build安装包
BUILD_INSTALL=false#设置存放编译结果的目录 
export ALT_OUTPUTDIR=/home/javon/jdk/openjdk-7-src/build

unset CLASSPATH 
unset JAVA_HOME 
make sanity 
make 2>&1 | tee $ALT_OUTPUTDIR/build.log

Description: ALT_BOOTDIR is the Bootstrap JDK installation directory. 5. Modify a file in the Open JDK source code, d573945737aa889c598e1fbb9059fea6/jdk/src/share/classes/java/util/CurrencyData.properties. What you need to do is to change the following in the file Change the time to a time within 10 years:

AZ=AZM;2015-12-31-20-00-00;AZN
MZ=MZM;2016-06-30-22-00-00;MZN
RO=ROL;2015-06-30-21-00-00;RON
TR=TRL;2014-12-31-22-00-00;TRY
VE=VEB;2018-01-01-04-00-00;VEF

6. Execute the compilation script

#cd <OpenJDK源码目录>cd /home/javon/jdk/openjdk/sh build.sh

7. After the compilation is completed, the following directory will be obtained under the ALT_OUTPUTDIR path,


. Among them, the j2sdk-image directory stores the complete compilation result of the entire JDK. We enter the entire directory and type "java -version", and we will get the following results:

Problems encountered during the compilation process

1. The operating system version is not supported. This OS is not supported.

## Solution:

Modify the file d573945737aa889c598e1fbb9059fea6/hotspot/make/linux/MakeFile, SUPPORTED_OS_VERSION = 2.4% 2.5 % 2.6% 3% and then add 4%. The modified content is:

SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4%

The above is the detailed content of Detailed steps for compiling JDK in Linux environment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete