Sign In/My Account | View Cart |
Related Reading Ant: The Definitive Guide |
Editor's Note: Every time we do a survey, we find that fewer and fewer Java developers are using a strictly command-line/text-editor approach. The overwhelming majority are using an IDE, and for most, the IDE of choice is Eclipse. Given that, do you really want to enjoy an IDE for creating your code, only have to go out to the command line to build it? Of course not. In this first of a two-part excerpt from Ant: The Definitive Guide, 2nd Edition, Steve Holzner shows how to integrate Ant with Eclipse, from creating a project to writing an Ant build.xml file in Eclipse, and running the build from inside the IDE.
Ant is the premier build tool for Java developers, and Eclipse is the premier integrated development environment (IDE) for Java programmers. Eclipse is great at visual development, and Ant is great for builds. For that reason, the latest Eclipse version (3.0) comes with Ant 1.6.1 (the version of Ant this book was written with), and there's an extensive Ant interface in Eclipse.
TIP: Doesn't Ant have its own IDE? Well, sort of. Antidote, started in 2000, was supposed to have been the Ant IDE; see archive.apache.org/dist/ant/antidote/. Unfortunately, that project appears to be more or less moribund, largely because the big guys behind Eclipse have been integrating Ant into their IDE now.
If you're a Java developer, you know how finicky Java can feel at times. Missed import
statements, forgotten variable declarations, omitted semi-colons, garbled syntax, and typos will cause the Java command-line compiler, javac
, to cough and display pages of error messages.
The error messages tell you that javac
knows what the error is, so why doesn't it just fix the problem and let you continue developing? javac
can't fix the problem; to do that, you can use an IDE, which will catch errors before you compile and suggest solutions. Java is badly in need of a good IDE, and the premier Java IDE these days is Eclipse. You can see what it looks like in Figure 11-1.
Figure 11-1. Eclipse
Eclipse is free for the downloading, like a number of other Java IDEs, but Eclipse has a serious advantage behind it, which is the power of IBM, reportedly spending $40 million developing it. It's now an open source project, largely under IBM's development but part of a software consortium named eclipse.org
.
TIP: Want to read more on Eclipse? See Eclipse by yours truly (O'Reilly).
Eclipse is free for the downloading; all you have to do is navigate to www.eclipse.org/downloads. Select one of the download mirrors available on that page. When you do, you'll be presented with a list of the available downloads of these various types:
These versions are for general use.
These are comparable to beta versions.
These builds are made up of components that have been fairly well tested, but their operation together may still have some issues.
These are the most experimental of all publicly available Eclipse builds. They're created nightly by the Eclipse team, and there's really no guarantee that things will work well.
TIP: As with other software, you generally want to use the latest release version of Eclipse; I'll use Eclipse 3.0, the most recent release build, in this chapter.
Select the download for your operating system and click the appropriate link to download it. Installing Eclipse is easy; all you've got to do is to unzip or untar it, depending on your operating system. Since you download the version of Eclipse targeted to your operating system, you'll find the executable file ready to run as soon as you uncompress Eclipse. You start Eclipse by running the Eclipse executable. When you first run Eclipse, you should see the Welcome page. To get an overview of Eclipse or to run a tutorial, click the appropriate links. To close this Welcome page, click the X in the page's tab.
Pages: 1, 2, 3, 4 | Next Page |