Skip to main content
This revision made April 10, 2013 23:41, by neomatrix369


NOTE $SOURCE_CODE is where you installed the source code to. If you are using the AdoptOpenJDKVMBuild then this is /home/openjdk/sources If you are using YourOwnEnvironment then it's likely to be something like /home/<your username>/sources

Auto Configure

We're using the new build-infra based build system for OpenJDK.

NOTE You cannot run this new build and the older Old_Build at the same time, it's one or the other. In particular if you'd started with the older build, you'd need to unset the ALT_ variables that are part of the Old_Build set-up instructions.

To execute the new build-infra build, run the following:

 cd $SOURCE_CODE ;
 cd jdk8_tl ;
 bash configure ;

NOTE: With the new build system, its no long needed to be navigate to the ../common/makefiles folder, you can run bash configure from the root (i.e. $SOURCE_CODE/jdk8_tl).
NOTE: This will likely fail the first time due to missing packages. The autoconf tool will tell you exactly what's missing, see the Install Missing Packages section below.

Install Missing Packages

Debian/Ubuntu

This works for:

  • Ubuntu 12.04 and 12.10
  • Probably most Debian based distros
  • Fedora up from 17

You'll need to enter your sudo password and say Y when prompted:

 sudo apt-get install build-essential openjdk-7-jdk libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libfreetype6-dev libcups2-dev libasound2-dev ccache g++-4.7-multilib

NOTE: ccache and g++-4.7-multilib are optional but speed up and support C++ builds in Eclipse respectively. If you get an error with g++ -4.7-multilib, replace that with g++ -4.6 -multilib

Windows

Since the preparation and configuration consists of quite a few steps, there is a dedicated Build Windows page.

Mac OS X

See how to build OpenJDK on the MacOS.

Fedora

This works for:

  • Fedora up from 17

You'll need to enter your sudo password and say Y when prompted:

 sudo yum-builddep java-1.7.0-openjdk

A simple way to radically speed up compilation of native code (typically hotspot and native libraries in JDK) is to install ccache:

 sudo yum install ccache

Check the default version of java

To check which version of Java or the java compiler is installed on your system, enter the following command in a terminal window respectively:

  java -version
 
 or 
 
  javac -version

You should see something like the below output for the first command (your minor and build number versions might be newer):

 java version "1.7.0_04"
 Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
 Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

Note: In order to build the OpenJDK projects, you require JDK/JRE version 1.7 installed on your system and set as the default Java version to use.

Windows

Since the preparation and configuration consists of quite a few steps, there is a dedicated Build Windows page.

Choosing the default Java to use

Debian/Ubuntu/Fedora

If your system has more than one version of Java, configure which one your system uses by entering the following command in a terminal window

 sudo update-alternatives --config java

This will present you with a selection that looks similar to the following (the details may differ for you):

 There are 2 choices for the alternative java (providing /usr/bin/java).  
 Selection Path Priority Status 
 ———————————————————— 
 * 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode 
 1 /usr/lib/jvm/jre1.7.0/jre/bin/java 3 manual mode  
 
 Press enter to keep the current choice[*], or type selection number: 1

Windows

Since the preparation and configuration consists of quite a few steps, there is a dedicated Build Windows page.

Rerun autoconf

Once all of the packages are installed, run:

Debian/Ubuntu

 bash configure - if you are positioned at the root

You should see a success message similar to the below:

 ====================================================
 A new configuration has been successfully created in
 /home/openjdk/sources/jdk8_tl/build/linux-x64-normal-server-release
 using default settings.
 
 Configuration summary:
 * Debug level:    release
 * JDK variant:    normal
 * JVM variants:   server
 * OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
 * Boot JDK:       /usr/lib/jvm/java-7-openjdk-amd64 
 
 Build performance summary:
 * Cores to use:   1
 * Memory limit:   2003 MB
 * ccache status:  installed and in use 

Note: In the case of Ubuntu 12.10, the above might fail when it does not find a valid installation of JDK or JRE. It can be fixed by running sudo apt-get install openjdk-7-jre-headless, or any other openjdk-7 package of choice.

See configure command arguments for build performance optimisation.

Windows

Since the preparation and configuration consists of quite a few steps, there is a dedicated Build Windows page.

Next Step

OR

Difference compared to previous revision
You'll need to enter your sudo password and say ''Y'' when prompted: sudo apt-get install build-essential openjdk-7-jdk libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libfreetype6-dev libcups2-dev libasound2-dev ccache g++-4.7-multilib '''NOTE:''' ccache and g++-4.7-multilib are optional but speed up and support C++ builds in Eclipse respectively. If you get an error with g++ -4.7-multilib, replace that with g++ -4.6 -multilib
 
 
Close
loading
Please Confirm
Close