Detailed steps for compiling JDK in Linux environment

不言
Release: 2019-03-12 15:29:52
forward
3753 people have browsed it

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
Copy after login

2. Unzip Open JDK.

unzip openjdk-7u75-src-b13-18_dec_2014.zip
Copy after login

3. Install Bootstrap JDK.

./jdk-6u45-linux-x64.bin
Copy after login

4. Create a new shell script in the Open JDK directory: build.sh, /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
Copy after login

Description: ALT_BOOTDIR is the Bootstrap JDK installation directory. 5. Modify a file in the Open JDK source code, /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
Copy after login

6. Execute the compilation script

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

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 /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%
Copy after login

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!

Related labels:
jdk
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!