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


NOTE $SOURCE_CODE is where you are installing 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

Install Mercurial

OpenJDK uses Mercurial as its source control system. Mercurial is DVCS, similar to git. If you aren't familiar with Mercurial, you should download this free book which has good Mercurial coverage.

The command for Mercurial is hg - because Hg is the chemical symbol for Mercury.

NOTE: OpenJDK used to use the 'forest' extension - which required specific versions of Mercurial and was somewhat of a pain to work with. Recent builds do not require forest - and it is no longer maintained, so do not use forest with OpenJDK - and remove all reference to it from your ~/.hgrc file.

Get the source

Debian/Ubuntu

This works for:

  • Ubuntu 12.04 & 12.10
  • Probably most Debian based distros

Open a Terminal, you'll execute the following steps:

  1. Check that you're in a directory that you're happy to install the openJDK source code in.
    1. If you are following the Virtual Machine instructions then this should be /home/openjdk
  2. Set up directory structure
  3. Install a git client (Git is used for submitting patches to the Patch Review GitHub project).
    1. (enter your sudo password and say Y)
  4. Install mercurial DVCS client (The OpenJDK project uses Mercurual as its DVCS)
    1. (enter your sudo password and say Y)
  5. Clone the jdk8 repository
    1. Get the rest of the source code

Note: the last letter in jdk8_tl is the small letter 'l' and not the digit 1 - and applicable to all references to this term throughout the wiki.

The commands are as follows:

 mkdir $SOURCE_CODE ;
 cd $SOURCE_CODE ;
 sudo apt-get install git-core ;
 sudo apt-get install mercurial ;
 hg clone http://hg.openjdk.java.net/jdk8/tl jdk8_tl ;
 cd jdk8_tl/ ;
 chmod u+x get_source.sh ;
 ./get_source.sh ;

MS Windows

In order to retrieve sources from the OpenJDK mercurial repo, please perform the below installations first.

Install Cygwin

From http://cygwin.com/setup.exe

In addition to packages selected by default, also select the following packages (there is a search field at the top):

  • [Devel] binutils
  • cchache
  • [Utils] cpio
  • [Utils] files
  • [Base] awk / gawk
  • gcc
  • gcc-core
  • [Devel] make
  • [Interpreters] m4
  • [System] procps
  • unzip
  • vim
  • [Archive] zip
  • [Archive] unzip

Note: Do not add C:\cygwin\bin to your system path.

The following command should select all needed packages:

 setup.exe -R C:\cygwin -P binutils,cchache,cpio,file,gawk,gcc,gcc-core,make,m4,procps,unzip,vim,zip (Note: this stopped working starting a certain version of Cygwin - if the command-line action does not work, you will have to select the packages manually).

This is your future shell where al the OpenJDK building happens.

Install TortoiseHg

From http://tortoisehg.bitbucket.org/download/, Filename: tortoisehg-2.5.1-hg-2.3.2-x64.msi.

This is needed to actually clone the OpenJDK mercurial repositories.

Clone the hg repository and get the jdk sources

Start a cygwin shell using the desktop icon

 $ cd /cygdrive/c
 $ mkdir OpenJDK
 $ cd OpenJDK
 $ mkdir jdk8_tl
 $ hg clone http://hg.openjdk.java.net/jdk8/tl jdk8_tl
 $ cd jdk8_tl
 $ bash get_source.sh


Mac OS X

From the Mac Terminal application

  • Set up directory structure
   Ensure $SOURCE_CODE is set  - see beginning of the page.
   cd ~
   mkdir $SOURCE_CODE
   cd $SOURCE_CODE
 Go to http://git-scm.com/download/mac
 Download the Git…dmg file, and open it.
 Double click on the git…dpkg file in the folder.
 Git installation starts.
 [Optional] Copy the setup git PATH for non-terminal programs.sh from within the folder to outside the folder i.e. Git folder and run it from the terminal prompt.
  • Install mercurial DVCS client
 Go to the Mac section at http://mercurial.selenic.com/downloads/
 Download the .zip file that corresponds to your version of the Mac OS.
 Unzip the zip file, and double click on the .pkg file to start the installer.

(On a Mac it's probably better to use the binary installers for git & mercurial.)

Now download the source and prepare for build:

 hg clone http://hg.openjdk.java.net/jdk8/tl jdk8_tl ;
 cd jdk8_tl/ ;
 chmod u+x get_source.sh ;
 ./get_source.sh ;


Next Step

OR

Difference compared to previous revision
# Install mercurial DVCS client (The OpenJDK project uses Mercurual as its DVCS) ## (enter your sudo password and say ''Y'') # Clone the jdk8 repository ## Get the rest of the source code'''Note: the last letter in jdk8_tl is the small letter 'l' and not the digit 1 - and applicable to all references to this term throughout the wiki. The commands are as follows: mkdir $SOURCE_CODE ; cd $SOURCE_CODE ;
 
 
Close
loading
Please Confirm
Close