About Me

My photo

...am a nice person, that's it..... i think so.....

Monday, May 27, 2013

Setting up OpenJDK source code

Recently, I had to set up OpenJDK on my system for work. This involved getting the source code, compiling the source, and setting it up in your preferred IDE. The steps are easy, but I had to dig around a bit on the Internet to collect necessary information. In this post, I will basically attempt to list down the steps together.

Get the source

The OpenJDK web page lists a few alternative ways of getting the source code, for example using mercurial repos, or directly downloading the compressed source bundle. I did try to user mercurial, but I got build errors while using make. Also, the link to the compressed source bundle on the OpenJDK webpage links to an old revision of the source for java 7. Instead I used the following to get the source for java 7. An advantage of  this is that this bypasses running into silly build errors that would otherwise crop up if you used the old java 7 source. The link I recommend using is https://jdk7.java.net/source.html.

Building the source

Extract the source bundle, and navigate to the root directory. The root directory should have a Makefile. There are a lot of options that can be passed to make to configure many individual parameters, however I will ignore talking about those for now. Just execute

make ALLOW_DOWNLOADS=true debug_build

This should build your compiler successfully. You are done.