Jera Design : Tech Info : Jera Tech Notes

JTN001 - Some Useful Free Software for Java Developers

Introduction
Tools
Testing
Libraries
Not Java-Specific
J2EE
Not Free, But Still Worth Mentioning

Introduction

One of the nice things about programming for the Java platform is that there is a lot of great free software available for it. It's possible to put together an excellent development environment in Java without spending any money on tools or libraries. This document lists the free software that Jera Design and our clients have found to be the most valuable.

Tools

Jikes is a Java compiler written in C++ by IBM. It's both faster and stricter than the javac compiler that comes with Sun's JDK. Highly recommended. Available from http://oss.software.ibm.com/developerworks/opensource/jikes/

Ant is a build tool, sort of like make. Ant uses XML to describe what to build, and a single build.xml file usually suffices for an entire project (unlike make, where you typically have a Makefile in each subdirectory). Ant comes with many optional tasks, such as a JUnit task to automatically run all of your JUnit tests as part of the build process, and an FTP process that can let you deploy your application effortlessly. Because Ant is written in Java, you can easily write your own custom tasks for it. Available from the Apache Jakarta project at: http://jakarta.apache.org/ant/

JWhich is a simple tool written in Java that simply reads off the actual classpath that the Java virtual machine is using. Very useful for troubleshooting classpath problems. It helped me track down one very weird interaction that turned out to be caused by a stray copy of "xerces.jar" in Java's "ext" folder. Available from: http://www.clarkware.com/software.html#JWhich (There are a number of other highly useful utilities available on the same page.)

Testing

JUnit is a unit testing framework that's popular in the Extreme Programming (XP) community. It lets you write test cases that are executed by a test runner. It also supports test suites that group together multiple test cases. Available from: http://www.junit.org/

CruiseControl is a system that periodically checks out the latest version of your project, builds it, and runs all the unit tests. If any tests fail, it sends out an email listing which tests failed, and who changed which modules since the last time the tests passed. Excellent for enforcing the XP practices of testing and continuous integration. Available from: http://cruisecontrol.sourceforge.net/

HTTPUnit is a test engine for testing web applications via HTTP and HTML. You can tell it to go to a web page, fill in specific fields, and click on specific buttons. Then you can assert that values on the response page match specific values. Very useful for acceptance testing, but sometimes cosmetic HTML changes break the tests. Available from: http://httpunit.sourceforge.net/

Libraries

Xerces/Xalan XML and XSLT libraries from Apache.org. Less essential now that JDK 1.4 comes with its own XML parser, but still nice to have for pre-1.4 work, and for features not included in the JDK version. Available http://xml.apache.org/

JDOM The W3C XML DOM is nice, but it's written to work with any programming language. JDOM is a DOM that uses Java collections to iterate through subelments, and comes with utility methods that let you do things like produce pretty-printed XML from your DOM. Includes adapters for SAX and W3C DOM, so you can maintain compatabilty with other code. http://www.jdom.org/

util.concurrent Doug Lea's excellent concurrency utilities. Contains things like queues where one thread puts objects on and another thread takes them off. When the queue is empty, the taking thread blocks until something is put in the queue. Also includes semaphores, thread pools, and even an Ada-style rendevous. (See also Doug Lea's excellent book Concurrent Programming in Java, Second Edition ISBN:0201310090 (order from Amazon.com)) http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html

jakarta-oro is an open source regular expression library. It includes utility classes that provide compatibility with Perl regular expressions. This is what I used to port JeraWiki from Perl to Java. Available from http://jakarta.apache.org/oro/

Not Java-Specific

Cygwin is a port to Windows of the GNU versions of some standard UNIX tools. It includes a version of the bash shell, along with classic command line utilities like grep, tr and less. The current version has a modular installer that lets you install as much or as little as you like (a full install will include things like the gcc C compiler and the text formatter TeX). Available from: http://www.cygwin.com/

CVS is a popular free source code control system. It comes in both standalone and client-server versions. The client-server version can run over SSH for added security. Some people find the command-line syntax less than intuitive, however. Available from: http://www.cvshome.org/

Emacs is an open source text editor. It interfaces nicely with CVS, Ant, Java, Perl, and just about everything else. Emacs has a built-in Lisp interpreter, which makes extending its functionality relatively easy, compared to, say, Notepad. Some find the UI less than intuitive, but there exist extensions that at least partly fix this. Available from: http://www.gnu.org/software/emacs/emacs.html

J2EE

Tomcat is the reference implementation of the servlet specification. It's more than sufficient for playing with servlets and JSPs, and many people actually deploy applications on it, especially embedded web apps where the lack of per-server license fees is important. Available from: http://jakarta.apache.org/tomcat/

Struts is the de-facto MVC framework for servlet-based applicatons. The initial learning curve is rather steep, but it can pay off if you stick with it. Available from: http://jakarta.apache.org/struts/

Not Free, But Still Worth Mentioning

IntelliJ IDEA is the best Java IDE on the market today. It was the first IDE to automate complex refactorings like "extract method". It has a very intuitive UI, good CVS integration, and optional support for Emacs key bindings. Usually runs around US$400, but occasionally goes on sale for $200 for individuals. http://www.intellij.com/