Sun's proprietary language and Open Source may seem mutually exclusive. They're not.
As Open Source begins working its way into the field of vision of most developers, it’s only natural that open open source projects spring up in almost every programming language imaginable. One language getting quite a bit of attention in the open source world is Java. This might come as a surprise to those who know that Java’s originator, Sun Microsystems, has been a firm holdout on open sourcing many of its products. Sun licensed its own Java compiler and runtime under a “Community Source License” that drew fire from the open source community for not being Open Source compliant. There are actually some practical reasons, however, why developers are turning to Java for their open source projects and are reaping the benefits. This article provides a roadmap to major open source projects that involve Java and the different flavors of Java designed by its originator, Sun Microsystems.
The primary reason developers have turned to Java, of course, is its cross-platform nature, which eliminates the need to spend time and energy on porting issues. To help developers find the right mix of services and language extensions, Sun has recently split the Java platform into three distinct flavors: Java 2 Standard Edition (J2SE) for traditional desktop applications, Java 2 Enterprise Edition (J2EE) for server/enterprise, and Java 2 Micro Edition (J2ME) for embedded/consumer electronics.
The result of this change, at first, was confusion; developers tried to discern the differences between each of the “editions” of Java, when in reality, it boiled down to what one wanted to do with the language.
- you want to write desktop applications, then J2SE is likely to be your best bet. J2SE is essentially the old Java Software Developer Kit (SDK) repackaged.
- you’re doing a Web-based application that talks to a back-end SQL database, then J2EE is probably the way to go. It has many additions for the developer, including Enterprise JavaBeans for component management services and Java Messaging Services for robust and reliable messaging.
- project intended for use on a PDA would probably use J2ME, which is optimized for low memory consumption at the expense of having fewer available runtime services and extensions.
Not many open source projects are taking advantage of J2ME yet, but J2EE and J2SE are getting plenty of use. In fact, J2EE is experiencing an explosion of open source development in terms of both applications that use it and applications that provide services based on the J2EE specification. The result is that not only can developers create fully open source J2EE applications, they can do it almost entirely using open source tools and services. This assumes, of course, that they will be able to navigate the bewildering array of services and APIs that are available to them with J2EE. A guide that completely maps out J2EE is beyond the scope of this article, but for more information, see the Resources sidebar.
Several open source Java projects have the potential for a major impact on the industry, either by establishing a standard for similar products to follow or by penetrating markets because of a combination of high quality and open source licensing. While there is no way to highlight all of the fine open source Java projects out there, here are a few of the most visible.
Netbeans (http://www.netbeans.org) is both an Open Source Java Integrated Development Environment (IDE) and an Application Programming Interface (API) specification for creating extensible IDE-related functionality. The goal of the API specification is to provide standardization that encourages interoperable IDE components. In addition to Netbeans itself, another IDE that implements the Netbeans API is Sun’s Forte for Java (http://www.sun.com/forte/ffj).
The ambitious undertaking of creating a usable Java IDE that is written in Java has been tried several times in recent years, with varying levels of success. Netbeans itself began as an unwieldy, buggy application and still struggles with that stigma. As the Netbeans codebase, the Java runtime, and the average PC’s processing power have improved, though, so has the performance of Netbeans. While Netbeans is still far from perfect, and may test the patience of some developers, it can be comforting to know that you aren’t at the whim of some corporation’s release schedule when developing with your IDE.
The Netbeans interface is patterned after other industry-standard IDEs and is easy to pick up and understand. It also incorporates features found in other mature programmer tools, such as visual source control integration (CVS and several others) and package management. It has an active mailing list and Web site (as every successful open source project should), and there is constant effort to help Netbeans interoperate with other tools and systems.
JBoss (http://www.jboss.org) is a J2EE-compatible application server that is receiving a lot of attention due to its apparent market penetration. It provides open source developers with an application server that enables J2EE development, which might otherwise have been too expensive for such projects.
JBoss consists of an Enterprise Java Beans container and server components for messaging, transactions, mail, security, database connectivity, and object persistence. It also integrates with other J2EE services, such as Apache Tomcat and Jetty; both provide Java Servlet capabilities. The features that JBoss provides to the Java enterprise developer compare to what you would get from the best commercial offerings, including BEA Weblogic Server, Lutris Enhydra, and IBM’s WebSphere.
The JBoss Web site claims there are around 50,000 downloads per month. However, there is one thing missing from the download — documentation. The JBoss Group has fashioned a business model around selling consulting, documentation, and training for JBoss. If you don’t want to pay $10 for the downloadable documentation, you can use the older volunteer documentation from previous versions, which is still available free. In addition, JBoss also has an active mailing list and some Web-based forums with the usual cadre of helpful developers.
Developed by IBM and released under an open source license in late 1998, the Jikes compiler (http://oss.software.ibm.com/developerworks/opensource/jikes) is a high-performance Java compiler that strictly follows the specifications for the Java language and Java virtual machines to ensure compatibility. Where other compilers may allow for subsets or supersets of the language specification to be incorporated (and potentially compromise the compatibility of the code), the Jikes compiler will report such problems as errors and refuse to compile.
While IBM originally released the Jikes compiler under a closed source license, they were soon convinced to release it as Open Source, and nearly all of the current development work on Jikes is done by volunteer programmers, with IBM merely providing hosting. While there are other open source Java compilers, none have the reputation for performance and adherence to standards that Jikes maintains.
As a simple command-line compiler, Jikes is meant to be used with another of Java SDK’s distributed class files. There are other open source Java compilers, such as Kaffe, which come with their own virtual machines and class libraries, but Jikes has a single purpose — to compile, and do so well. Several IDEs (including Netbeans) allow Jikes to be substituted as the default Java compiler in whatever SDK is being used.
Although the Apache Group’s Jakarta project (see The Jakarta Project sidebar) maintains a Java Servlet/ JSP engine for its very popular HTTP server, that hasn’t stopped other open source implementations from vying for Web server space. One of the most popular open source Servlet/JSP servers is Jetty (http://jetty.mortbay.com), which is a completely Java-based, fully functional Web server.
If you’ve ever clicked around the Apache Software Foundation’s Web site (maybe checking on version 2.0 of the Apache Web Server), you might have noticed the link to the Jakarta Project (http://jakarta.apache.org). Of course, Jakarta is a name just cool enough to deserve a closer look. However, once you get inside, what’s going on? What are all those Java projects and what do they have to do with Apache?
The Jakarta Project’s stated intent is to, “provide commercial-quality server solutions based on the Java Platform that are developed in an open and cooperative fashion.” As the disparate projects to extend the Apache Web server have matured over the years, they have become part of the official Apache project structure. Still others have been donated by certain “interested” parties, like Sun Microsystems. The project structure has grown to accommodate several technologies, one of the most prominent being server-side Java.
Despite this consolidation, several of the 21 Jakarta sub-projects have relevance beyond server-side Java — some even beyond Java itself. There are countless ways one could divvy up the goods, and the people at the Jakarta Project have recently grouped them into “Libraries, Tools, and APIs,” “Frameworks and Engines,” and “Server Applications.” Another way to look at the projects is to consider who would use them: server-side Java developers, general Java developers, and sysadmins or Web developers who have no real interest in Java (other than what it can do for them in a finished product).
One place to start is the Jakarta Commons (http://jakarta.apache.org/ commons), which is listed as one of the projects on the Jakarta site, although it is less a project than a merge point for all the other Jakarta projects. As each Jakarta project matures, individual reusable components are created that are potentially useful in other projects, even outside the Jakarta effort. As these appear, they are included in the Commons, which increases their visibility.
Server-Side Java Developers
Server-side Java is what Jakarta was originally intended to be about. It still forms the core of the project.
Apache’s Java Servlet/JSP engine, Tomcat can be run standalone for simplicity or in conjunction with Apache for performance. It implements the Java Servlet and JavaServer Pages (JSP) specifications. It was, in fact, originally donated to Apache by Sun Microsystems so that a reference implementation could be developed. Perhaps due to this and to the Apache HTTP server’s huge user base, Tomcat has become a very popular choice for servlet and JSP development (For more on Tomcat, see “Hangin’ With Tomcat,” at http://www.linux-mag.com/2001-10/tomcat_01.html
A framework for building Java Servlet/ JSP-based applications, based on the Model-View-Controller (MVC) design concept, Struts simplifies the development of JavaServer Pages applications by providing separation of code logic from the presentation of data. In keeping with the Jakarta project’s spirit of cross-pollination, Struts is employed by fellow Jakarta project Slide.
Another Java servlet application framework that integrates with many templating tools, including Cocoon (an Apache XML project, http://xml.apache.org/cocoon
) and Velocity (see below), Jetspeed, another Jakarta project, uses the Turbine framework.
A template engine meant as an alternative to JSP in the presentation layer of the project, it claims to provide better separation of program logic from the user interface than does JSP. JSP freely mixes code logic with HTML, which can lead to difficulty in maintaining code if not used carefully.
A library of custom taglibs, which are specialized markup tags used to extend Java Server Pages (JSP), the library is quite large and covers a lot of enticing subjects, including database access, XSL, and regular expressions.
A Java API for the programmed construction of elements for markup languages such as HTML and XML, ECS essentially creates an object tree with each object representing a tag. The tree can then be printed out or manipulated further.
A desktop application for load-testing server-side applications and intended for Web-based applications, regardless of the language they are coded in, it can graph and analyze their performance under heavy loads.
A testing framework for server-side Java applications, it uses and builds upon the popular JUnit testing framework.
A development framework and collection of useful components and services (such as logging and connection pooling) for use in creating a server application, it reportedly grew out of the development process of Apache’s JServ project (now being continued under the Jakarta Tomcat project). The popular Cocoon project from the Apache XML Project uses Avalon as the basis of its development.
This site contains validation tests for the Java Servlet and JavaServer Pages (JSP) specifications.
General Java Developers
These projects can prove useful in any Java project, server-side or otherwise.
An attempt to make a better make,
the quintessential developer’s build management tool works under the assumption that “Makefiles are inherently evil.” The Ant project has created a build management system based on XML files and various task-oriented code objects. While some developers might laugh at the idea of trying to redesign make
using XML, Ant does provide a cross-platform solution by abstracting the build process from the build environment, which, like Java itself, makes the transition from one platform to anther much easier. For more on Ant, see http://www.linux-mag.com/2002-01/
Many of the more experienced Java programmers will correctly recognize this project as the old OROMatcher and PerlTools libraries that provided Perl-compatible regular expressions for Java. The code has been donated to the Jakarta project and is being actively maintained. The Jakarta RegExp project actually duplicates some of the functionality as these libraries, but Jakarta seems to not mind providing a choice.
Another regular expression library similar to the ORO project, it has also been around for several years and was donated to Jakarta by the original developer.
This is a logging API for Java that attempts to provide a flexible logging facility with low overhead. Logging is enabled or disabled via a configuration setting, without having to modify the compiled code.
This is a system for automatically retrieving source code from remote repositories to compile or create documentation. Like most of the projects in Jakarta, it uses XML as its configuration file format and makes extensive use of the other projects for its functionality, especially Ant. Jakarta actually uses Alexandria to test and document its own projects in an experimental system they’ve dubbed Gump (http://jakarta.apache.org/gump
A tool for analyzing and manipulating compiled Java code, it converts the compiled code to objects that can be modified and even written back to the file.
Sysadmins and Web Developers
Jakarta has acquired or spawned a few projects that are server products usable by non-developers. Mainly servers and Web-based utilities, these projects deserve a look from anyone involved in Web site maintenance, even if Java is not part of the development toolkit.
A low-level search engine system written to enable indexing of just about anything through custom-written filters, Lucene is more of a starting point for a search engine than a complete solution. It seems mainly intended to provide developers who need search engine capabilities with an easily extended tool.
A mail server implementing the Sun JavaMail API and written entirely in Java, it both stores and transports mail and reportedly allows easy addition of processing logic that enables things such as automatic language translation or mail-to-fax bridges.
This is a content management system that makes extensive use of WebDAV for editing Web documents. It is currently in beta.
This is an engine for creating an informational Web site (called an “Enterprise Information Portal” on the Jetspeed site) using one of several templating and content publication frameworks. Information can be pulled from disparate sources such as RSS, SMTP, and XML. The system then uses XSL to format the information. An interesting facet of this project is support for WAP accessibility.
Created by Mort Bay Consulting, Jetty is popular enough to have been the target of integration efforts in other open source projects, including the previously mentioned JBoss. Known for its efficient operation and flexible design, it is even embeddable in other applications to provide HTTP networking capabilities.
Downloading and running Jetty is relatively simple using the documentation included in the distribution, although the more advanced configuration that is possible may take longer to grasp. Jetty has several active mailing lists, one of which is entirely devoted to support.
Next Up: Corporate Users?
As you might have noticed, all of the projects that were mentioned are what one might call “infrastructure” projects — applications that enable other applications. This seems to be the focus of most highly visible open source Java developments right now, as the open source community strives toward a comfort zone in terms of product licensing and the stability of their software.
Like Open Source Linux before it, Open Source Java will find that, once it has made significant inroads into the corporate server room, it has another whole group of users hungry for quality open source code. Whether or not it will deliver, we’ll have to wait and see.
This site contains information, documentation, tutorials, and downloads related to Java and its various flavors (J2EE, J2SE, and J2ME).
Although you can search SourceForge for Java projects from any point on its site, the Java Foundry is a good entry point. You can get a glimpse of recent news items related to open source Java development, as well as a quick list of the most active Java projects hosted on SourceForge. You will find Jetty, JBoss, and several other high-profile projects hosted here.
The Giant Java Tree’s intent is to create a large tree of entirely open source Java code. Some full-fledged Java applications are hosted here, including the popular jEdit programmer’s editor and jCVS, a Java-based CVS client. The GJT is source code oriented, rather than project oriented, so although you will find complete projects here, you might also come across individual source code items and libraries that are intended for use in other projects.
James Tillman enjoys cross-platform programming in both Java and Perl. He is currently a volunteer “Foundry Guide” for SourceForge’s Java and Perl foundries. He can be reached at email@example.com.