Tame TIGER:JDK 5.0 Source code license

Source: Internet
Author: User
Tags constructor zip stringbuffer

Sun recently released the source code for JDK 5.0 through the Sun Community Source code license (Community source LICENSE,SCSL) and the Java Research License (Java study LICENSE,JRL). This month, Tiger's columnist, John Zukowski, took time out of the details of the new release, outlining the terms of the license and what source code access was provided to developers. He also gave a brief introduction to the J2SE 6.0 release Mustang amazing early visits. Share your thoughts on this article with the author and other readers in the corresponding discussion forum. (You can also click the Discussion Access forum at the top or bottom of this article.) )

Sun's decision to release JDK 5.0 source code, in addition to providing access to public classes, provides access to non-public classes, giving developers more insight into the behind-the-scenes content of the latest release-if you don't mind complying with the license terms. I'm not involved in the argument that Sun is supposed to open up the Java platform, but instead shows you how to get the source code and discuss two licensing options: the Sun Community Source code license (SCSL) and the Java Research License (JRL). I'll also briefly discuss the early-access snapshot version of 6.0 Mustang binaries and source code.

Standard source code Download

The source code for the Java platform public API and all the classes mentioned in Javadoc are part of the standard JDK delivery, and you can access them. To access these source files, you need to install them with JDK downloads. If the size (MB) is given, JDK downloads are optional, so you must make sure that the download is selected at the time of downloading. After installation, simply unzip the file into a subdirectory, as shown in Listing 1.

Listing 1. Returns the 1.4 default Steel theme

cd c:\jdk1.5.0
mkdir src
cd src
jar xvf ..\src.zip

Now, if you're having trouble developing your code and getting an unexpected stack dump, you can look at the source code for the system class to see why. For example, it is not correct to call the StringBuffer constructor with a null parameter. Why, then? Looking at the source code, we learned that the constructor attempted to get the length of a string. Although there are documented instructions in Javadoc, the StringBuffer construct failure throws a NullPointerException exception, but viewing the source code lets you know why it failed. Because you cannot call the length method on a null object pointer.

Note: The source file is saved with a Unix line break, and if you view the source code with an editor such as Notepad, it can be difficult to read because there is no carriage return in the file. If you want to convert these files, then Javaworld Java Tip 64 will still be useful.

JDK 5.0 Source Code Pack

The JDK does not provide all the source code for the platform. Public classes in the Java.* and javax.* packages are provided, but no public classes in sun.* or virtual machines are provided. JDK 5.0 Source code package is to make up for this shortcoming. If you can follow the terms of any of these licenses (described later), you can access the full source code of the platform (which allows Sun to expose the platform). These two licenses permit something, but they also have their own release restrictions. You can access the source code from the Java 2 Platform Standard Edition 5.0 page. Just click the download link for the license you want to follow, read and accept the license terms, and then click the first download link to display the list of files for the group. At this time, there are two download links, one is MB zip format source code files, the other is a security file (for example, encryption provider), less than 1 MB. Download the source file, after decompression can be studied. There is another 2 MB binary file download, which includes shared libraries, fonts, and pictures. Have it better, no or can.

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.