OpenJDK: Building JDK

Source: Internet
Author: User
Tags file system http request zip vmware fusion visual studio java se linux

Editor's note: In this issue of open source, the author and founder of Cafe Au Lait Elliotte Rusty Harold took over the current Java SE 7 Development series article. Because the objectives and processes of the OpenJDK project have been introduced in the first phase, Elliotte will directly introduce the actual build of JDK 7 in this tutorial.

Prior to this, if the OpenJDK project is updated, we will publish it at the beginning of the "Open source" section of each issue. The latest release is B23, and the release date is October 30. This release addresses a small number of defects and functional requirements, as detailed in its release notes, many of which are related to management issues, such as top-level README files, space cleanup, and removal of legacy "J2SE" references. The previous version B22 solved more problems, integrated 65 bug fixes and 14 features, including splitting CORBA, JAXP, and Jaxws into their respective workspaces, replacing Swing ThreadPool creation with Java.util.concurren T functionality, support for various time zone changes, and the creation of OpenJDK Renderingengine plug-ins, which means "provides a starting point for the Open JDK to replace the ductus library." ”

But how do you achieve all these new goals? This is exactly what Elliotte will be describing in this article, and he will explain how to build the JDK from the source.

Since Sun's Java development Toolkit is free software (just modeling some widgets in the process of substitution), we might as well make some changes to the case. Whether you're passionate about optimization, experimentation, language design, debugging, or documentation, there's a lot of work that needs to be done, and there's plenty of opportunities for developers of all skill levels. In subsequent articles in this series, I will elaborate on the various API developments that may occur in Java 7 or later. However, to play around with these APIs, you will need a bloody battle, so immediately dump your first aid kit, rip off the tourniquet and prepare to shed some blood! We're going to start building the JDK.

System Requirements

First, a supported operating system is required to build the JDK. This includes Linux, Solaris, Windows XP, and Windows Vista. Mac OS X is not supported. Apple is responsible for migrating the JDK to the MAC, however, which often lags behind the trend. However, MAC users can use parallels, VMWare Fusion, or Boot Camp to run Windows or Linux and build JDK in them. Indeed, this was the way I wrote this, when the Ethernet card in My computer died accidentally two days before the project was completed. However, we still can't run Java 7 (or 6) applications in Mac OS until Apple releases the latest JDK. This may happen tomorrow, probably next year, or it may never happen.

Second, we need an up-to-date Java 6 SDK. Java 7 cannot be compiled with Java 5来. Personally, I don't like too many version dependencies when designing software, which is especially important for open source software. However, the JDK only recently opened its source code, and it shows some of the legacy of corporate IT: "We can control everyone's build environment." Removing some of these dependencies is an ongoing task that will take years, but the process has made initial progress. Just recently, Sun shifted its source library from proprietary TeamWare to open source Mercurial. Switching from closed development mode to open development mode is a daunting task, but the end result is a stronger, more flexible, more robust code base.

Third, we need a C compiler. Some of these JDK are written in native code. They can't all be written in pure Java. For Linux, we need to use GCC4. In Windows, you need to use Microsoft Visual Studio. NET. For Solaris, you need to use Sun Studio 11.

In Linux, you may also need to install or update some libraries. Which libraries you want to install depends on your release and edition. You may also need to install a set of C header files for an existing library. In this article, I use the existing Ubuntu 7.10 gutsy Gibbon release. Most other reasonably circulated distributions should work as well. If you find that there are some distributions that are not working, try to find out why and record the defects.

Finally, in Windows, you can build on the NTFS file system. You cannot build JDK on FAT-32. You also need to install Cygwin, because the JDK built on Windows is a singular mixture of windows and Unix utilities.

Get the source

About every one months, Sun publishes a complete set of JDK source code on the OpenJDK source page. Several different packages are listed below:

OpenJDK Source JDK 7 is about 95% of the main source code. Platform binaries Sun doesn't actually have all the code in the JDK, and they can't re-register code they don't own. In contrast, some code snippets must be provided in a closed-source binary package. You will need to download some of the code for your platform. Linux, Solaris, and Windows are supported in both 32-bit and 64-bit versions. Jtreg Test Tool binary package download code test framework. You don't have to really use a test framework to build or modify your code, but you should be able to master it anyway. OpenJDK Module Project This includes a new modular system for Java 7. (I'll explain this in a later article in this series.) Eventually, this project will be rolled up into the JDK, but now you don't need it immediately.

Because these projects occupy more than 120MB of space, the speed of downloading servers may not always be particularly fast, so it may take a while to download them all. One of the benefits of open source is that you don't have to click through annoying licensing. You can download any Open-source software from a normal URL. This makes it easier to use similar tools like curl, wget, and more. Set up batch jobs to get these tools, and then you can have a leisurely cup of coffee. In fact, no clicks make it easier to use a normal browser. Click through the registration method should be able to be abolished. Click through registration just to make lawyers busier, besides lawyers who need these things?

jars@jars-desktop:~/openjdk$ wget
http://www.java.net/download/openjdk/jdk7/promoted/b23/ Openjdk-7-ea-src-b23-30_oct_2007.zip
--18:02:02--
Http://www.java.net/download/openjdk/jdk7/promoted/b23 /openjdk-7-ea-src-b23-30_oct_2007.zip
=> ' openjdk-7-ea-src-b23-30_oct_2007.zip '
Resolving www.java.net ... . 64.125.132.37, 64.125.132.39
Connecting to www.java.net|64.125.132.37|:80 ... connected.
HTTP request sent, awaiting response ... Moved Permanently
Location:
http://download.java.net/openjdk/jdk7/promoted/b23/openjdk-7-ea-src-b23-30 _oct_2007.zip
[following]
--18:02:02--
http://download.java.net/openjdk/jdk7/promoted/b23/ Openjdk-7-ea-src-b23-30_oct_2007.zip
=> ' openjdk-7-ea-src-b23-30_oct_2007.zip '
Resolving Download.java.net ... 72.5.124.114
Connecting to download.java.net|72.5.124.114|:80 ... connected.
HTTP request sent, awaiting response ... OK
length:84,617,174 (81M) [Application/zip]
44% [===============>] 37,717,212 55.36k/s ETA 12:19

Now, we only need the first two conditions: OpenJDK source and Binary plug-ins. However, you may need two additional conditions in the future.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.