Developer

Get more than you pay for with NetBeans 3.4

Find out how the latest version of NetBeans stacks up against the competition. According to this review, you don't have to pony-up big bucks for a top-notch Java IDE.


With so many great open source software projects out there, it seems like we programmers don’t really need to spend much money. NetBeans is one such project. It’s been around for a while, and its IDE, used primarily for Java projects, is the unbranded open source version of the Sun ONE Studio IDE (formerly Forte for Java). I first experimented with NetBeans a few years ago, when it was good, but a little wobbly. After looking at the latest version, I can easily see how much it has matured.

Breezy installation and a good first impression
The InstallShield download of the Windows version of the NetBeans IDE 3.4 is about 29 MB, and the wizard uses sensible defaults. All in all, the installation process on my Windows notebook was unobtrusive and painless.

My first test whenever I try a new IDE is to see how fast I can write, compile, and run a “Hello World!” program after installation. NetBeans scored high on this test. There is a welcome screen, which I generally dislike, but this one is unobtrusive. I ignored it completely, and invoked the New Class File Wizard, which created a simple class file with a main method already built in. I typed the obligatory code, clicked the execute button on the toolbar, and it compiled and ran. All told, the trip from downloading the installation file to compiling and running my first class was completely painless and quick—a great first impression.

Coding and building GUIs
The NetBeans code editor supports all the standard features you’d expect: syntax coloring, intelligent indentation, and code completion. The code completion additionally shows a portion of the Javadoc entry for the member that is currently highlighted in its pop-up list, as Figure A illustrates. Moreover, you can quickly jump to the complete Javadoc entry for an object by selecting it or one of its members, right-clicking, and choosing Show Javadoc from the resulting menu (or by simply hitting [Alt][F1]).

Figure A
The code completion shows you partial Javadoc entries.


Like most developers, I like to be able to get toolbars and docked windows out of the way when I’m going to be coding “head down” for a while. To my pleasure, I discovered that NetBeans lets you dissociate the editor window from the main portion of the IDE so it can float freely. A maximized editor window in that state gives you almost the entire screen for coding. You can also create, manipulate, and save multiple workspaces to display the IDE in various configurations while you work.

The Swing GUI editor contained everything I expected to see, including a competent code generator. In addition to the standard control palette and drag-and-drop placement, NetBeans has a separate window with a tree hierarchy of the components on your form. This helps you select individual components and gives you easy and direct access to their properties even when they are covered by other visual components on the form itself.

For action objects such as JButton, the editor generates the action listener as an anonymous inner class whose handler method calls one or more separate handler methods that you can specify on your own in the properties window. The editor will generate the skeleton code with the appropriate event argument. The important parts of the generated code are read-only in the source code editor, so you can’t accidentally confuse the designer by messing up the code.

Abstract source file and project management
When it comes to source file management, NetBeans basically abstracts the underlying file system and ignores everything other than what you tell it. You can tell it about locations in your underlying file system by mounting folders in the Filesystems portion of the Explorer window. NetBeans uses these mounted file systems to organize the Java packages and build classpaths for compilation and execution. If you are using a third-party Java package, such as something in a .JAR file, you will also need to mount that. This approach allows NetBeans to treat underlying system directories and single .JAR files in the same fashion.

In addition to using mounted file systems for package organization, you can organize your own coding efforts into projects, which allow you to group things together and compile them at once. It’s not necessary that the files in a project come from the same mounted file system, and the distinction between the two concepts can sometimes be confusing—it was for me anyway. Fortunately, the online help system does a pretty good job of explaining both concepts.

Compiler and Javadoc integration
NetBeans comes with the javac, fastjavac and jikes compilers listed in the compiler configuration, but you can modify this list with new tools as well as reconfigure the settings for the default compilers. Similarly, the IDE provides extensive support for plugging in third-party tools: The Ant build tool and Tomcat Web server are both fully supported and part of the default installation. The IDE also includes file templates for both Ant scripts and JSP files to help you get started with either tool.

Extensive support for both viewing and generating Javadocs is also included. Generating Javadocs for your code files is just a command away, and you can specify a custom doclet should you need to. One of my favorite features is the Auto Comment tool, which helps make adding documentation painless, even after the fact, when you’ve already written the code. As you see in Figure B, this cool feature shows you a window that reports the documentation status of all the parts of your current code file, indicating with different icons the severity of any omissions. For example, if there is a method that doesn’t have any recognizable Javadoc comment whatsoever, it puts the scary red X icon next to that method. All you have to do to clean up your act is fill in the fields.

Figure B
The Auto Comment tool makes documentation a breeze.


The downside is hard to find
For the most part, NetBeans leaves me with very little to complain about. I find the IDE’s options dialog a bit overwhelming. You really have to understand how NetBeans itself is organized to make use of it. Since NetBeans is itself a Swing application, it shares the relatively common complaint about Swing GUIs: It feels slow. Things you click on don’t jump to life with the same speed you might expect. It’s certainly not dreadfully or even annoyingly slow; it’s simply noticeable.

Also, I did get a few exceptions while running the IDE. While that’s undesirable, I was actually rather impressed by how it recovered after I closed the exception dialog. It was as if nothing had happened; I resumed without having to exit the program.

Finally, NetBeans lacks one hot feature that other IDEs such as JBuilder include: a refactoring tool. There are several add-ons available for NetBeans and many of them are free, but the only refactoring tool add-on I found was RefactorIT, with a $200 price tag. After downloading the trial and working with it inside NetBeans, I now covet it, but I’ll have to pass it up for now.

Give it a try
NetBeans has come a long way and keeps getting better thanks to Sun’s backing and the efforts of a dedicated developer community. It features all of the coding support you would expect and goes a step further with its fancy use of pop-up Javadocs. The IDE’s design facilitates the creation of add-on modules so that other popular tools—Ant and Tomcat being just two examples—can extend its available functionality.

It’s not married to a specific compiler, debugger, or doclet engine either; all of these and more are fully configurable. If you haven’t dedicated yourself or your team to a specific Java IDE, download NetBeans and give it a try. And if you already have a Java IDE that's not free, you may want to try NetBeans and avoid future upgrade costs associated with your current IDE.

Editor's Picks