Browse OpenJDK Java source code in Eclipse

  Pi Ke        2014-06-16 00:53:34       9,773        0    

Java 8 was recently released, many developers are now trying to extract the source code of Java 8 to find out how the new added features such as Lambda expressions, default method in interfaces, new Time API are implemented. How do you manage to download and browse the source code? Today we are going to show how to extract OpenJDK Java source code to Eclipse.



Since OpenJDK is adopting Mercurial as its distributed version control system, you need to install Mercurial on your computer first before you can clone the repository from OpenJDK. You can get more info about the use of Mercurial in OpenJDK.

Then if you have Eclipse installed,  you need install and configure one more plugin called MercurialEclipse which is a plugin for managing the Mercurial repository. Below are steps to install and configure MercurialEclipse.

1. Open Eclipse, go to Help->Eclipse Marketplace..., in the search box, type "MercurialEclipse", choose the first one to install.

2. After installing it, you need to restart your Eclipse, you need to configure the plugin to use the Mercurial executable installed. Go to Window->Preference->Team->Mercurial, click on it and on the right panel, you will need to specify the Mercurial Executable, click the Browse button next to the field and find the executable hg.exe you installed. Then click OK.


3. Next we start to import the repository from OpenJDK, select File->Import->Mercurial->Clone Existing Mercurial Repository, click Next, then you need to enter the URL for the repository. You can find all repositories at http://hg.openjdk.java.net/. The complete URL should be http://hg.openjdk.java.net/<project_name>/<repository_name>. For example, the Java 8 JDK URL is : http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/. Note since we are cloning the repository from OpenJDK and OpenJDK doesn't require authentication for clone, so we no need to fill the Username and Password at the authentication area.

4. Type your local project name and click Finish, the cloning process will start and it may take a few hours to clone the source codes.

You can also go to Window->Show View->Other...->Mercurial to open Mercurial view.

If you want to view the source code on the browser, you can type the URL above into your browser, and then on the left side, click "browse", you will see the folder structure now and the source codes are in the src folder.

OPENJDK  JAVA 8  SOURCE CODE  ECLIPSE 

       

  RELATED


  0 COMMENT


No comment for this article.



  RANDOM FUN

Yet another QA