< Zurück | Inhalt | Weiter >

10.4.4 Working with Eclipse

Eclipse is a huge topic. We can’t devote enough space to it for this chapter to qualify as a user guide. The best we can do is to offer you a handful of tips.

• The Java perspective consists mainly of the Package Explorer on the left, the edit window in the middle, the outline view in the right, and a bottom window that changes based on context. Initially, it is a task list. When you run a Java application, the console output is displayed there, overlaying the task list.

• You can do a lot of what you need to get started on a project by right- clicking in the Package Explorer. For example, you can create a package by right-clicking and selecting New > Package. When you type a new package name into the resulting dialog box, all required folders are created under the project.

• You can create new classes and interfaces in the same way. If you right- click on a package in the Package Explorer and select New > Class or New > Interface, an appropriate dialog box comes up, and a skeletal file is created in the appropriate place.

You can compile, run, and debug programs by hitting buttons on the toolbar, by selecting from the menu, by right-clicking almost anywhere, and by keyboard shortcuts. To put it plainly: Eclipse is a modern, rich IDE that works like other IDEs you have seen.

Eclipse’s real advantages lie in some of the dynamism it offers. As you know, the authors of this book like text mode and command line, but we must admit that Eclipse’s refactoring features are a great timesaver. For example, when you use the refactoring tools to change a method, you can be certain that every call to that method, everywhere in the project, is updated. Sure, we staunch CLI guys will tell you that you can use pipes and sed to similar effect, but even we must admit that you can miss some. We stand by what we have said: Know all the tools, and you can then choose the right one. But if all you have is a hammer, you’ll end up using it to repair a china cup.


We’ve given you the choice of two great development environments. With them you can do so much more than just edit and compile. Both are expand- able to include other tools, like CVS and JUnit. Each has a slightly different paradigm for how they manage files and projects. It seems the longer we work with one (either one), the more we like it. They kind of grow on you and you get used to some of the shortcuts that they offer. And yet, there are still those times when it’s handy to be back at the simple command line.


10.7 Resources 259


NetBeans comes with a built-in version of Tomcat for serving up Web pages and JSP and Java Servlets. It’s very handy for developing and testing on your desktop. We’ll look at that more in Part IV of this book.

In the NetBeans help file, you’ll find this intriguing note:

Using Scripting Languages in NetBeans: NetBeans provides you with a scripting feature that lets you use scripts to operate the IDE remotely or from the Scripting Console or by using a scripting file. You can use the scripting languages provided in the Scripting Console, or you can create a scripting class through the New From Template wizard. The following scripting languages are provided with NetBeans: DynamicJava, BeanShell, and JPython. For information on the scripting languages provided, see DynamicJava at http://www-sop.inria.fr/koala/djava/, BeanShell at

http://www.beanshell.org/, JPython at http://www.jpython.org/.

We barely got you into Eclipse. Eclipse supports CVS (check out the Team submenu). Eclipse provides code refactoring features that allow you to rename classes and methods with automatic update of all affected source. Eclipse provides a feature to “externalize” strings (which takes all string con- stants out of a module and makes them into properties references, allowing for easy internationalization). It is a powerful Java development platform.


NetBeans. NetBeans has some very extensive online help. There are also some very good Web-based documents, including the user guide which can be found at http://usersguide.netbeans.org/. Of particular value is the Getting Work Done guide at http://usersguide.netbeans.org/gwd/ which describes itself as “a more detailed introduction to the IDE than available in the Getting Started tutorial.”

Support for NetBeans, as with many other Open Source projects, happens online. There is no toll-free number to call. Instead you subscribe to an e-mail list; all messages sent to the list are then forwarded to everyone on the list. Anyone can respond, and you are encouraged to respond too, to share what you know with others. The NetBeans developers are often the ones who answer

the most difficult questions, but lots of times answers come from others who have just made it a little further up the learning curve than you.

To subscribe to the nbusers list, send e-mail to nbusers-subscribe@ netbeans.org. You might want to create a special mail folder for the constant stream of messages that you’ll get from nbusers. We’ve seen about 15–20 mes- sages per day, on average, over the past year. You don’t need to read them all, but as you scan the subject lines, see if there are ones that you might be able to answer. If you want others to reply to your requests for help, it would only be fair for you to do likewise. For a directory of the many e-mail lists related to NetBeans, go to http://www.netbeans.org/community/lists/.

Eclipse. The Java Developer’s Guide to Eclipse by Sherry Shavor et al. (ISBN 0321159640, from Addison-Wesley Professional) is an excellent book on the Eclipse platform, particularly from (as the title suggests) the Java developer’s point of view. Eclipse is, however, more than just Java. It is designed to be an “IDE Factory,” providing a framework for almost any task that involves an edit/compile/deploy kind of lifecycle.