How to compile OpenJDK on Ubuntu
http://www.vogella.de/articles/OpenJDK/article.html
Lars Vogel
Version 0.3
Copyright © 2009 - 2010 Lars Vogel
30.11.2008
Revision History | ||
---|---|---|
Revision 0.1 | 30.08.2009 | Lars Vogel |
Created | ||
Revision 0.2 - 0.3 | 12.11.2009 - 25.07.2010 | Lars Vogel |
bug fixes and enhancements |
OpenJDK
This article describes how to download the source code of OpenJDK and how to compile it. The platform which is used in Ubuntu.
Table of Contents
- 1. OpenJDK Overview 2. Install Mercurial and Extensions 3. Clone the OpenJDK repositories 4. Compile OpenJDK 5. Thank you 6. Questions and Discussion 7. Links and Literature
-
- 7.1. Source Code 7.2. General
1. OpenJDK Overview
OpenJDK is the open source implementation of Java. OpenJDK is under version control by a distributed version control system called Mercurial . This guide will describe how to install Mercurial, download the source code of OpenJDK and how to compile OpenJDK.
2. Install Mercurial and Extensions
You first need to make sure Mercurial is installed on your system.
sudo apt-get install mercurial
In addition to standard Mercurial you also need the Forest Extension. These are currently not packages for Ubuntu, see Bug report
You can get the forest extension via the following command. This will create the directory hgforest with the file "forest.py".
# close the forest extensions
# if the url below does not work you find alternative url via
# http://bitbucket.org/repo/all?name=hgforest
hg clone https://[email protected]/vogella/hgforest-crew
Edit the file "~/.hgrc" (i.e. the mercurial configuration file) to include the lines.
[extensions]
forest=/home/vogella/hgforest/forest.py
After this change you should be able to use commands such as 'fclone' and 'fpull' is you type in "hg" in the command line.
Install the build dependencies via the following commands:
sudo aptitude build-dep openjdk-6
sudo aptitude install openjdk-6-jdk
3. Clone the OpenJDK repositories
Clone the OpenJDK7 respositories via the following command.
hg fclone http://hg.openjdk.java.net/jdk7/jdk7
Alternatively you can clone OpenJDK6 via the following command.
hg fclone http://hg.openjdk.java.net/jdk6/jdk6
4. Compile OpenJDK
Switch into you OpenJDK directory and compile it via:
#set a few environment variables for the build:
export hl-number">6-openjdk
make ALLOW_DOWNLOADS=true
After a long time the compilation should be successful. The default output directory is build/platform, where platform your operating system. The build/platform/j2sdk-image/bin should contain executables for the OpenJDK tools. The "demo" dirctory contains several demos which you can use to validate your build. Try "./java -version" in your "/build/platform/bin" and validate that you see the version of OpenJDK which you compiled against.
5. Thank you
Please help me to support this article: