Sure, this article should have been published mid-March to play off of the title. It would have been nice to include my favorite recipe for Caesar Salad dressing. It didn't happen. If you want, I can bring in an excuse note from my mom. Some of you sent in your favorite Integrated Development Environments (IDEs) and I tried them all. I expect that many of you will have much to add to this discussion. Please use the comments at the end of the article to highlight features or weaknesses in the various IDEs.
Until mid-December I never used an IDE except as a teaching tool. I always used a text editor and command line tools for my real work. When I taught, I used the environment the school supported. For those schools determined to standardize on an IDE I even pushed the ones I liked the best. For the most part, the students used Windows boxes for development.
For the past four years, I've most often recommended JBuilder for schools. Borland (http://www.borland.com), the makers of JBuilder, has a very generous license for academic organizations and offers a solid tool that works well on different platforms. I do sometimes use it at home and, for the most part, really like what they've done with it. It works well on Mac OS X and includes features not available in other IDEs. I've enjoyed using JBuilder and recognize their commitment and contributions to Java on the Mac.
That being said, I now use IDEA from JetBrains (formerly IntelliJ) for my daily work. There are no RAD tools and it isn't as slick as some of the other offerings. They've done nothing to provide support for a Mac look and feel. On the other hand, the support for coding is darn near perfect. IDEA helps me write code. It thinks of things before I do and lets me know what it's come up with in a nice way. It helps me write and refactor code.
For example, once I've moved a couple of methods out of a class and no longer need a particular import statement, it provides me with a gentle visual reminder that I can remove that line of code. Their slogan is "Develop with Pleasure," and I think they help make that happen.
In this article, I'll look at JBuilder, IDEA, and a few other IDEs. There's a bigger issue here that I'll address in the Pre-ramble: look at the number of choices you have for developing in Java on Mac OS X.
Looking ahead, Apple holds their Worldwide Developers Conference (WWDC) next month in San Jose. The Web page promises that this year's WWDC looks to the "future of Mac OS X." Also, Apple announced that at that time we can expect a beta of JDK 1.4.
If you aren't an Apple Developer Connection (ADC) member, at least sign up for the free subscription (http://developer.apple.com). Although they've made no announcements about the details of their distribution plans for JDK 1.4 betas in the past, Apple has made the Java pre-releases available to all ADC members. As always, you can send me email about this column or with suggestions for future columns to DSteinberg@core.com, with the subject line "O'Reilly Mac Java."
Apple ran two technical sessions and a BOF (Birds of a Feather) at last month's JavaOne Conference in San Francisco. The sessions were targeted more at those attendees who weren't familiar with what Apple is doing with Java on Mac OS X.
Ted Goldstein, Apple's new "guy in charge of Java and other stuff," presented an overview of Java on Mac OS X. Goldstein's actual title is vice president, Development Tools. In addition to highlighting J2SE on Mac OS X, he listed J2EE certified offerings from Pramati and Lutris that run on the platform. JBoss and Orion also run well on a Mac.
Goldstein told a story about how hours before this session he had approached the guys at the Trifork booth to challenge them to port their application to Mac OS X. Half an hour later the port was finished. For Goldstein, that's a big part of the Java story on the Mac: stuff just works.
An interesting thing happened at the JavaOne Mac BOF. Alan Samuel, Apple's Java Technology evangelist, and Allen Dennison, Apple's Java Product marketing manager, started off the session by answering the inevitable questions before they were even asked. They said Java 1.4 was on the way and although Apple has already been working on the 1.4 release, the focus was to deliver a solid 1.3.1 version of Java on the platform.
Audience members then asked about this feature or that. One after another the questions were either "when are we going to see" a given technology or "when are you going to fix" some problem with another technology. This isn't unusual. Sun's Swing team had a similar BOF the next night. When developers are able to meet with the engineers responsible for a technology, they tend to ask these type of questions. Alan, Allen, and the engineers present answered all of the questions as they were asked. And then the interesting thing happened
Up until this point Goldstein had been quietly standing against a wall, way off to the side. At this point he asked if there was anything about Java on Mac OS X that people liked.
The mood in the room completely changed. Longtime Mac developers raised their hands to make comments about how the issues being raised were, by and large, minor and that in general they were very pleased with the performance of Java on the Mac. It was as if the family of Mac developers in the audience realized that they were in front of company.
The company may not know the context of these public complaints about flaws in Apple's support of Java. Goldstein's comment was able to redirect the feeling of the room because Alan, Allen, and the engineers weren't dodging the questions being asked. By the end of the BOF, audience members were again asking about plans for supporting their pet features.
After that BOF I checked with various friends who had worked with Goldstein before and asked if people had made the mistake of underestimating him. They all smiled and answered, "Not twice." Much of the reason that Java on the Mac is so solid is due to Goldstein's predecessor Steve Naroff, and the quality of the engineers working on the project. The great news is that Naroff is still at Apple. It's early, but I think we're lucky to have Goldstein working at Apple as the guy in charge of Java. With his ties to Sun, I hope that Goldstein can help Sun see how valuable Apple is to the Java story.
The 1.4 support issue is not a small one. The argument on one side is that Sun has only gone final with 1.4 in February so Apple isn't that far behind. Apple has been promising to narrow the gap in Java releases to 60-90 days after Sun's final release for more than four years now. Dennison said the reason the delay was a little longer this time was that Apple's Java engineers have been working on improving the performance of 1.3.1. The 1.3.x release was the first version of Java on Mac OS X and Dennison points out that many of the improvements being made to 1.3.1 will pay off as Apple moves forward to 1.4.
The argument on the other side of the 1.4 support issue is that developers have had access to 1.4 beta releases for over a year now. If Apple wants programmers to develop on Mac OS X then, many argue, Apple needs to supply these pre-release versions in addition to the final releases.
As a practical matter, Apple has answered, it can't provide the engineers to work on a moving target. In discussions in online forums developers have questioned whether the programmers asking for 1.4 support really need 1.4. There have been instances where engineers have said they need particular functionality. Often they have been given workarounds; in other cases they've been told there is no alternative and they'll have to wait for 1.4.
The underlying concern seems to be with the future of Java on the Mac. The question of "When will version xxx be available for the Mac?" has been asked since the first release of Java. At that time, Mac users would have to wait more than a year for the latest release of Java on the platform.
Consider that Mac OS X just became the default operating system a few months ago and that no version of Java 2 (that's versions 1.2, 1.3, and 1.4) is supported on the classic Mac platform. With Mac OS X the default OS, Apple can deliver the latest versions of Java through a software update to both developers and to end users. As the install base of classic Mac OS wanes, the Java on the Mac story gets stronger.
Both IDEA and JBuilder are top choices for the Java developer on Mac OS X. I still think that a new iMac -- with a second keyboard and second mouse, loaded up with IDEA -- is a perfect choice for Extreme Programming, but I also like a lot of what JBuilder offers.
If you're looking for tools that are free as in beer, Apple provides Project Builder and you can also use Net Beans or JEdit. JEdit isn't a full-featured IDE, but it does have many of the features you use most of all. Couple it with an AppleScript that manages your other tasks (see last month's column) or learn to work with Ant, and you have all that you need. Heck, you might have all that you need with Emacs, vi, TextEdit, or BBEdit.
The traditional favorite of Mac Developers, Metrowerk's CodeWarrior, is still the IDE of choice for Mac users coding in C or C++. Metrowerk's says that most of the ports from Classic Mac to Mac OS X were done with CodeWarrior. Unfortunately, the Java tools are still lacking. To be fair to Metrowerks, they are a release behind everyone else. It may not be fair to compare their release from more than a year ago with the more recent releases of other vendors. CodeWarrior 8 is scheduled to be released this summer.
IDEA is available from IntelliJ Software. The current version is 2.5.2, although you can get a look at betas of version 3.0 at http://www.intellij.com/eap. The list price is just under $400, but they are now running a half-price Easter sale for personal licensing. They also make a version available to academia for $99. To run IDEA, open up a terminal window, navigate inside of the bin directory and run the shell script
idea.sh. You should see something like this:
IDEA from IntelliJ software (Click for larger image)
The first thing you'll notice is that it doesn't look very Mac-like. IDEA actually runs much better on my Mac box than on my Windows box but, except for the title bar, the IDEA window looks very much like a Windows application. The menu bar is attached to the window and not to the top of the screen in the standard Mac position. I'm less rabid about this than others. I think that in an IDE it's easy enough to use the menu bar in the same window that you're working in.
|Let's discuss your favorite Java IDE, and any other Java topics that come to mind.|
The third line of code includes an import statement that isn't needed yet. At the right side of the screen you can see a yellow box that signals that something superfluous is in the code. If I click on the yellow stripe, it highlights the offending code and provides me with the message "Import statement is redundant." I can, of course, choose to ignore the warning and the code will compile and run without any problems.
If there was an actual syntax error the box would have been red with red horizontal lines that would take me to any line of code found to contain an error. As with compiler errors, fix the first one first and see which others are taken care of. A dropped bracket could render a lot of code to be non-compilable.
A nice feature of IDEA is that you can configure the help to be presented in a way that works with your coding style. If you don't want to see warnings, you can turn them off. Suppose you introduced an instance variable of type
Jframe. IDEA can be configured to add the import statement
import javax.swing.Jframe or
import javax.swing.*. It can also just insert
Jframe where you've typed it in the source file.
You set these defaults so that you aren't annoyed by the help you are getting from the IDE. I initially ignored much of the help that IDEA provided. The more that I work with the IDE and trust it, the more I've come to benefit from its help. One of my favorite tools is the support for refactoring. Click on the Refactor menu item and you'll find support for some of your favorite refactorings.
You can also refactor classes by highlighting a class in the left project window. In that context you can move or rename classes. When you do, the relevant names are changed and imports are altered. You can also extract the interface from a class or create a superclass from a given class. While you're looking around the project hierarchy, you'll notice there's also support for CVS as well as Ant.
I don't tend to use RAD tools. If you do, then IDEA may not be the tool for you. On the other hand, when it comes to programming, I like it more and more each day.
As an aside, as a teacher IDEA is the best tool for me to examine student code. I can use options such as "Find Usages" to see where methods are called and to quickly navigate their code and figure out what they're doing. IDEA also makes it easy to create my own templates to make frequently used coding patterns (such as unit tests) easy to enter.
Sure, I just raved about IntelliJ's IDEA, but I like a lot of things about Borland and JBuilder too. You can get JBuilder 6 at http://www.borland.com/jbuilder and the prices vary from the free Personal Edition to the $1,000 Professional Edition or the $3,000 Enterprise Edition.
JBuilder is an example of a well-written application written entirely in Java. This is a first class application that looks and behaves like a native application on Mac OS X. In fact, those people at the BOF complaining about the performance of Swing on Mac OS X should compare the responsiveness of the pure Java application JBuilder to that of the native Carbon application Word.
After you install JBuilder, you double-click on a icon just as you would for native Mac applications. Here's a look at the same code presented by JBuilder that you saw presented in IDEA above:
Borland's JBuilder (Click for larger image)
You can see that the Borland engineers have really put a lot of effort into providing a Mac-like experience. JBuilder 6 is a single codebase for all of their target platforms. The look and feel of the target platforms makes JBuilder look like it has been custom-made for the platforms. Borland committed early to Mac OS X and their engineers have helped Apple identify issues with the Apple port of Java that needed to be addressed.
JBuilder provides a great deal of support for working with your code. As expected, some of the features are not available in the lower-priced editions. The code insight with JBuilder is very responsive and helpful. Change a method name or signature in the code and you will see these changes reflected immediately in the listing of methods and fields for the class at the left. Type in a method name and you will see a pop-up of allowable signatures. The code insight also helps by prompting you to write appropriate JavaDoc comments.
JBuilder is very well-designed and is highly configurable. You basically get the same JBuilder experience available on other platforms, it just seems to run better on a Mac.
In addition to code support, JBuilder provides the RAD tools for you to lay out your GUI if you'd like. The interaction between the graphical view and the code is fast and tight. You can modify the code and see the changes in the GUI immediately, or modify the GUI view and see the changes in your code.
There is also a view for working with JavaBeans that allows you to specify whether or not a Bean is serializable, to set the events that your bean can fire or listen for, and to take advantage of BeanInfo. JBuilder also includes a view for looking at the history of a source document. You can easily track the changes between versions and roll back your code. You can use JBuilder with a version control system such as CVS, or just depend on the history feature for versions that your machine is aware of.
The UML view gives a representation of the current class along with a collapsed view of all collaborating classes. Some of the implementation is a bit difficult. For example, in the picture below, the class
satellite.model.Satellite doesn't extend anything. In Java, this is taken to mean that Satellite extends the common root class
java.lang.Object. Notice that this relationship is drawn into the diagram. That is decidedly non-standard. The class Board in the diagram below extends
javax.swing.Jpanel. You won't see that relationship until you select Board. Then the fields, methods, and relationships for Board are highlighted and the Satellite class is collapsed. This is not the UML support that products such as Structure Builder have provided in the past.
JBuilder's UML view (Click for larger image)
You'll notice that a couple of refactorings are available from this view. I would expect JBuilder's support for refactoring to grow and improve in the future. JBuilder is a mature application that contains a rich set of well-designed tools. It supports the building of enterprise and J2SE applications.
For the most part, I don't need all of the widgets they offer, so I find the price a bit high. Of course, your mileage may vary. Borland has been very good at quickly integrating support for new technology and techniques. For example, not only do they support the standard views of unit tests run from JUnit, they also provide their own view that lets you track down errors in your code using the results of the unit tests. From this point of view you can see that the cost of the tool is what supports future development.
The best news about Project Builder is that it is part of the Developer Tools distributed free with Mac OS X. Again, if you haven't signed up for the ADC free membership, you should do so. In the past the software updates relevant to developers have been posted for free on the ADC site. The latest tools are the December 2001 release that includes support for AppleScript. Apple continues to develop the IDE. For now the Java support is not its strong suit.
Project Builder supports multiple languages and so is a compromise solution. As a free tool, it's OK for Java development but doesn't do much more than syntax color and provide a shell for compiling, building, and running applications. One of Project Builder's strengths is that it is a Mac product and so it produces double-click applications for the Mac. If you want to deploy your application on other Macs running OS X, Project Builder makes this process easy. Project Builder also supports CVS. Here's a screen shot of our same application in Project Builder:
Project Builder by Apple Computer (Click for larger image)
One of the most consistent requests from Java developers is support in Interface Builder for Swing. Interface Builder is a RAD tool that allows you to design the GUI for applications that conform to the Aqua guidelines (you can see screen shots of Interface Builder in last month's Java article). You graphically add and manipulate Aqua widgets and then write the code that supports them.
For example, you would drag a button where you want it and then write the code that details how a button will respond to a click. There is no support for allowing Interface Builder to work with Swing applications. It would be nice for Java developers to be able to place the button and then fill in the code for a corresponding
There are, of course, layout issues. The Java layout managers do not layout applications according to the Aqua guidelines. Having basic functionality of being able to place components using Interface Builder would be a great help to Java developers and would make Project Builder a lot more attractive. You could even use the stub code generated by Interface Builder in your favorite tools.
You can get NetBeans at NetBeans.org. Follow the instructions for expanding and installing the IDE.
In particular, you'll need to use gnutar and not StuffIt to expand the
tar.gz version. You'll also have to edit the
runide.sh shell script found in the bin subdirectory.
runide.sh with TextEdit or your favorite editor. At the top you'll see the following:
# the value set here can be overridden by $JDK_HOME or the -jdkhome switch jdkhome=" "
In between the quote marks enter the location of your JDK home: /System/Library/Frameworks/JavaVM.Framework/Versions/CurrentJDK/Home. Save the changes and run the shell script and NetBeans starts up.
You can perform more changes to the shell script to improve NetBeans' look and feel or you can follow the installation instructions and set the look and feel when you run the shell script using the following command:
./ runide.sh -jdkhome /Library/Java/Home -ui com.apple.mrj.sing.MacLookAndfeel -fontsize 10
The first flag sets the
jkd home so you don't have to edit the shell script. The second flag enables the Aqua look and feel, and the third flag sets the font size so that the screen looks right. Here's a screen shot of Netbeans with the Aqua look and feel:
NetBeans IDE 3.3.1 (Click for larger image)
If you would rather not mess with the shell script or even open up a Terminal window to run your IDE, help is on its way. The developer releases of NetBeans now include a GUI front end for running the application. Download the latest developer release, expand it, and look inside the bin directory. You'll see a disk image file named
Mount this image and take the file
NetBeansLauncher and place it somewhere convenient (I've put mine back inside the bin directory). Double-click on it. You'll be prompted to find the root directory. Navigate to the NetBeans directory that contains the bin directory where you just found the
dmg file. Now go ahead and use this application to launch NetBeans.
You can select Preferences from the Apple menu and change the look and feel settings. This application is basically a GUI front end to the shell script. The only way you know that something is unusual is that you have two NetBeans icons in your dock. One is for the launcher and the other is for the application.
NetBeans is an open source offering that is then repackaged and distributed by Sun as Forte. Much of the help that was present in IDEA and JBuilder is also available here in NetBeans. If you type "mover." inside one of the methods in the source file, then the methods and fields available to you from a class of type Mover appear in a pop-up window. You have a wide assortment of wizards for working with Beans, JSPs, RMI, Servlets, CORBA, and much more.
NetBeans has a ton of functionality. In my opinion, where it is lacking is in the usability and performance end. In an open source project it's fun to add a new feature. It's not as much fun to spend time improving the responsiveness of existing features, but this makes all the difference to users of an IDE.
I feel ungrateful complaining about a product that is made available for free by a community that doesn't get paid for their efforts. I do, however, find NetBeans to be a cumbersome tool to use. It does a lot, but trying to figure out how to perform simple tasks took some effort. Creating a project from an existing set of source files isn't hard once you figure it out. But for beginners it's not clear how to create a project and add existing files to it.
I looked in the File menu and the Project menu and stumbled around for quite awhile. You can avoid some of this start-up frustration by taking time to read through the ample tutorials and documentation provided. For example, I was annoyed at having to work with a bunch of small windows until I noticed that I could have opened up the Setup Wizard and could have chosen the full screen mode.
In his book Humane Interface, Jef Raskin cautions against the notion of an intuitive interface. Often we consider familiar models as being intuitive and unfamiliar, but perhaps better-designed, models as being unintuitive. That being said, I found that getting started with NetBeans was much less intuitive than getting started with JBuilder, IDEA, or Project Builder.
Eclipse is an open source project from OTI that will form the foundation of IBM's WebSphere Workbench. Erich Gamma (one of the Gang of Four and co-creator of JUnit) leads the effort for Java tools. There are a lot of very powerful and interesting features in Eclipse. Unfortunately it isn't available for the Mac. Eclipse is written almost entirely in Java. The sticking point is that the team decided not to use Swing and to use their non-standard SWT (Standard Window Toolkit) instead.
You can find out more about Eclipse at Eclipse.org. On the SWT page there is a list of target platforms. You'll notice that Mac OS X is not included, but there are efforts to write a carbon version of SWT. Andre Weinand is leading that effort and is looking for developers interested in helping out. You can find his March 22 version of the SWT for Mac OS X here. Join the SWT newsgroup on the Eclipse site for more information.
jEdit is an open source Java text editor available for free from jEdit.org. You can download a Mac OS X version of the application that expands to a disk image (.dmg) file. Double-click on this file and drag the resulting jEdit folder into your Applications folder. Now just double-click on the jEdit application inside of this folder and you can use JEdit almost like any other native application. (As an aside, one reason I'm looking forward to Apple moving to JDK 1.4 is the support for the scroll wheel.) The strength of jEdit for Java developers comes from the plug-ins contributed by the community. Here's a screenshot that shows some of the available plug-ins:
jEdit (Click for larger image)
For the most part, there's nothing here that couldn't be done with BBEdit or even with Emacs or vi. jEdit packages the capabilities much more nicely and makes it easy to call often-used functionality using the plug-ins. Where I saw NetBeans as overkill, others may see jEdit as underkill for an IDE or overkill for a text editor. I find it Mac friendly and easy to use. I don't expect too much from it, so I tend to be pleased with what I get.
There's a lot to consider when you choose an IDE. You may have budgetary preferences or constraints. In that case you may be more interested in the free choices. These include simple text editors such as vi, Emacs, BBEdit Lite, TextEdit, or jEdit. Alpha, a favorite of OzTeX users, should be available for Mac OS X in the next couple of months.
Also in Java Programming on a Mac
If you want to move up to free IDEs, your choices are Apple's Project Builder and the personal edition of Borland's Jbuilder, as well as the open source IDE NetBeans. Project Builder is not really focused on Java and so the tool may not suit your needs. NetBeans provides a lot of functionality but the usability and functionality may frustrate you.
JBuilder's free version does not include all of their tools. From time to time you find yourself wishing it would do something and then realize that it would if you pay for it. The free version is designed for hobbyists and students and not for professional developers in a commercial environment.
There are other free IDEs not covered in this article. ArgoUML and BlueJ are two tools that come to mind. You can use ArgoUML as a Java Web Start application or download it to your own machine.
As for the IDEs that cost you money, my current favorite is IDEA. Again you need to look at your needs. If you need support for GUI tools and are doing a lot of enterprise development, you may find that JBuilder 6 is a better choice for you. For code intensive projects, in my opinion, IDEA provides the most developer friendly environment. Finally, at this time, I found that Metrowerks' CodeWarrior is lagging behind other tools in their Java offering. Perhaps we'll see an improvement in the summer with their next release.
Daniel H. Steinberg is the editor for the new series of Mac Developer titles for the Pragmatic Programmers. He writes feature articles for Apple's ADC web site and is a regular contributor to Mac Devcenter. He has presented at Apple's Worldwide Developer Conference, MacWorld, MacHack and other Mac developer conferences.
Return to the Mac DevCenter.
Copyright © 2009 O'Reilly Media, Inc.