Ubuntu easy to compile OpenJDK

Source: Internet
Author: User
Tags mercurial

Spent three days on Windows OPENJDK, not familiar with bash, plus a variety of inexplicable dependencies and script bugs, physically and mentally exhausted. Finally make all the time produced a inexplicable error said what has warning and-werror to true, dead or alive no Google to-werror is what ghost, had to forget.

Today's rookie suddenly remembered, I also have Ubuntu virtual machine, right vote a try, did not expect easy success.

Platform: Ubuntu Version 5.1.30 (3.2.0-98-generic-pae #138-ubuntu SMP Mon Jan 13:11:12 UTC i686 i686 i386 gnu/linux)

Step 1: (Follow the commands in in-depth understanding of Java virtual Machines) One-click Download dependencies

1 sudo Install gawk M4 libasound2-dev libcups2-dev libxrender-dev xorg-dev xutils-dev x11proto-print-dev binutils libmotif3 Libmotif-dev Ant

It is not necessarily written here, but for the time being installed, the following if the lack of any reliance can be prompted to install, a Buddhist programmer's Day is to see recruit demolition.

OPENJDK's source code has C + + also has Java, so need a bootstrap JDK to compile Java part. This JDK is usually a version of the official JDK that you want to compile earlier than OPENJDK, which is the official readme-builds (under the root of the source downloaded in the second step) says:

... The general rule was that the bootstrap JDK must was an instance of the previous major releaseof the JDK.

Each version of the Readme-builds will indicate that this version of the OPENJDK required Bootstrap JDK specific version, such as openJDK8 need is jdk7u7 above the version, but not JDK8:

Step 2: Download the source code

sudo HG clone http://hg.openjdk.java.net/jdk8u/jdk8u-dev/cd jdk8u-dev  chmod755 get_source. SH . /get_source. SH

Download the latest source code for jdk8u with mercurial. Small partners If you want to download other versions of the source code can go here browse:http://hg.openjdk.java.net/. This download process takes about 30 minutes.

If you do not want to use mercurial, you can also download the zip package here: HTTP://JDK.JAVA.NET/JAVA-SE-RI/8 (in the lower side of the page RI source code there):

I compile on Windows is to use this ZIP package decompression compiled, and finally failed. Out of superstition, I decided to download the mercurial on Ubuntu, and the gods did not need to be ignored.

Step 3: Set Environment variables Create a new setup.sh and copy the following contents:

Export lang=C#bootstrap-JDK the installation path, replace it with your own bootstrap-path to the JDK export Alt_bootdir=/usr/lib/jvm/java-7-oracle-1.7.0.80Export Allow_downloads=trueExport Hotspot_build_jobs=8Export Skip_compare_images=true#要编译的内容, the reader can choose the export build_langtools according to their needs.=true#export Build_jaxws=false#export Build_jaxp=false#export Build_corba=falseExport Build_hotspot=trueExport BUILD_JDK=trueExport Skip_compare_images=trueBuild_deploy=falseBuild_install=false#编译结果存放的路径, it is recommended to store the OPENJDK source in the Build folder export Alt_outputdir=/usr/dev/jvm/openjdk/build# These two environment variables need to be removed, otherwise there will be a problem unset java_homeunset CLASSPATH

Run

./setup.sh

Set it all over again.

Step 4: Compile

It takes about twenty or thirty minutes to run make at the root of the OPENJDK source. It was supposed to run make sanity, but I ran into this error again ...

Mom Yo what ghost, search for a while no very results, so the chicken thief jumped over this step directly run make, unexpectedly successful, the output long after the success of this:

Ubuntu easy to compile OpenJDK

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.