Surviving in the wild with open source Java

Ever since the announcement of Sun's "liberating" of the majority of the Java code base last month, tech savvy sections of the Internet have been buzzing with what this might mean for the Java, Open Source and developer communities.

For those who missed the announcement: key parts of Java are to be released under the open source GPL V2 licence plus the Classpath exception (more on this later). The release of such a significant piece of software as Java under an open source licence ranks as the biggest single contribution of code to the open source community and has produced reactions ranging from fears that the entire enterprise Java community will collapse in a single stroke, to crowing at another sign of the inevitable downfall of proprietary software. Those whose expertise lies in Java development rather than the ins and out of software licensing may be wondering what all the fuss is about, and how this announcement applies to them.

The GNU General Public Licence or GPL is an open source licence backed by the Free Software Foundation. Reduced to its simplest form the GPL states that when GPL licensed code is distributed in binary form, the source code must be available as well, and also that whenever GPL licensed code is used in a software project then that project must be licensed compatibly with the GPL, meaning that its licence imposes no additional restrictions on use. This second point, generally referred to as "copyleft" within the open source community, is the source of the controversy. Could the open sourcing of Java mean that all Java projects be forced into a GPL license through their use of the newly GPL licensed Java Virtual Machine? Critics refer to this as the "viral nature of the licence: code that is GPL licensed "infects" other code that comes into contact with it, and forces its writer to release it under the GPL.

Naturally this has raised some alarm — the requirement to give out source code for free could threaten the business models of enterprise Java developers. Sun has been quick to pour water over these fears, reassuring the community that the release will mean business as usual to existing Java developers. The reason they can be so confident is the aforementioned Classpath exception, which was developed for the Classpath project: an open source port of the Java standard class library, and is also used in other open source Java initiatives such as Kaffe. The text of the Classpath exception is short, so it's worth a read:

Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public Licence cover the whole combination.

As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the licence terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the licence of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

The meat of this clause is that simply referring to Java code, either through linking to Java methods or extending Java classes, does not require you to use the GPL licence in your code. Only direct modification of Java code will confer the "copyleft" nature of the GPL. For example, were you to extend a GPL licensed Java class and use it in your own project then the Classpath exception would mean that you are not required to release your project under the GPL, however if you were to modify the original class and wished to release your changes, you would need to release them under the GPL. The end result of this being that only those developers working on Java itself, rather than with Java, are required to open source their code.