Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

OpenJDK: A Getting Started Checklist

DZone's Guide to

OpenJDK: A Getting Started Checklist

Interested in working on OpenJDK, either as a hobby or to contribute to Java as a whole? Here's a quick checklist to get your started.

· Java Zone ·
Free Resource

Automist automates your software deliver experience. It's how modern teams deliver modern software.

Hey all! I just got a chance to build the OpenJDK from its source code for a 32-bit Windows machine, so I thought I would share what I learned as well as the steps I used to build it. I hope it might be useful for you.

Why OpenJDK?

So the first thing that comes to our mind is: Why? Open JDK provides you with the freedom to play with the JVM, introducing or modifying the functionality as per your needs. OpenJDK is written in C++ and Java, so you must have a good command of both languages. You can use and distribute the modified version of Java for any purpose, as it falls under the GPL license. Working on OpenJDK also gives you the freedom to suggest or contribute the changes in Java. Obviously, they have a very tough process of review and testing before approval of any change, but here is your chance to be a contributor to the Java language.

How Is It Different From Oracle's JDK?

Oracle and OpenJDK are built on the same source code. However, both have different licensing policies — OpenJDK is more lenient than Oracle. Meanwhile, the Oracle JDK is an enterprise edition, where you can get some support. Both have a different cycle of release and may differ in some new functionalities.

Who Is Using OpenJDK?

Microsoft and Azul Systems collaborated together and created Zulu to build OpenJDK for users of Windows. IBM is also a user and contributor for OpenJDK and has its own version of Java, called IBM Java, which is based on OpenJDK. Apple also started making some public contributions to the project in 2011.

How to Build It

It took a significant amount of my time to be able to build OpenJDK successfully — it has a lot of dependencies on other software and plug-ins. But I learned a lot while building this, so I am just trying to put my experience in the following simple steps for your quick reference.

  1. Install HG Client to check out the code using the command line. Use the command below to check out the source code.
    hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/DirectoryName

    jdk8u is their 'update directory,' where they push all the latest changes. You can use the last release source or any other previous release, as per your needs.
  2. Run bash ./get_source.sh from the directory to get the entire OpenJDK repository.
  3. Install make. OpenJDK8 needs make 3.81 or higher version.
  4. Install mingw and mysys. OpenJDK needs a Linux-like environment to be able to run the build commands. You can also use Cygwin instead of mingw mysys.
  5. You also need Visual Studio 2010 professional. You can get it from Microsoft's official website.
  6. Below is the list of other packages that you may need to install if they are not already present on your build machine.
      • ar.exe
      • m4.exe
      • cpio.exe, gawk.exe
      • file.exe
      • zip.exe
      • unzip.exe
      • free.exe.
  7. The previous version of Oracle's JDK must be installed on the build machine, which will be used as a boot JDK.
  8. If you are building any Tag version of OpenJDK, then please switch to that before starting the build Process.
  9. The first step of building OpenJDK is to make sure that the system has everything needed to build. For this, you have to run the following command. This will generate error messages if any of the prerequisite software or files are missing. This can be one of the trickiest steps, so be ready for some patient debugging if something goes wrong.
    bash ./configure

  10. Once you are able to configure it successfully, then you have to run the make command to build it, like below.
    make all


  11. When your make command is successful, you can find the OpenJDK and JRE under the “\build\windows-x86-normal-server-release\images” directory in your build directory.

Cheers.

Get the open source Atomist Software Delivery Machine and start automating your delivery right there on your own laptop, today!

Topics:
openjdk ,open source ,java ,checklist ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}