Eclipse is a open source programmer's integrated development environment (IDE). In this practice you will setup Eclipse and run through some of its tools. At the end of the practice you should be able to write, test and debug simple Java programs using Eclipse.
Eclipse was built to be a generic IDE, offering support for many languages and extensions. The Eclipse site is http://www.eclipse.org. There you can download the tool for different architectures, like Windows, Linux or Solaris, download documentation and, if you wish, the source code of Eclipse. Other sites, such as http://www.eclipseplugincentral.com and http://eclipse-plugins.2y.net, offers to Eclipse users a large set of plugins and extensions that can be useful in the development of different types of applications.
The current version of the Eclipse Platform is the 3.x. To get it running, all you need to do is to decompress the package in a directory of your preference and execute it. There's no install manager, and the only thing to set is the workspace at the first time you run it. The workspace is the directory where Eclipse will store your Java Projects.
You will see the Welcome pane, offering to the user the options to see an overview of the IDE, tutorials and examples. You can choose the Tutorials option, Java Development and follow the instructions. After, read and explore the item Workbench Basics at the Overview option, and write about the main topics of this section in your report.
On the same project defined in the task above, create a class
called DebugTest
.
Add the following counter
method to the
class:
int counter(int b) { int a; for (a = b; a < b+20; a++) System.out.println("A = " + a); return a; }
Add to the main
method:
public static void main(String[] args) { DebugTest t = new DebugTest(); int r = t.counter(30); System.out.println("Result = " + r); }
Open the Console view, compile and run the program using the Run As -> Java Application option.
Now put a breakpoint in the for
line. Choose the Debug perspective and run the
program again, but now via the Debug As -> Java
Application option. Change to the
Variables tab and use the F5
key to step into the breakpoint. What happens? Describe on your
report.
The last task in the development of a Java application is to generate a JAR package containing all the classes of the application. A JAR package is a ZIP file that can behaves as an executable binary or simply stores resources (classes, configurations files, images, etc.) for another applications.
To create the JAR file in the Eclipse IDE select the menu File -> Export, choose the option JAR File and then click Next. Select which files will be exported and the package name. The last step is to generate the Manifest, which is a file that specify, among other things, the class that have a main method and can be used as an entry point for the application execution.
Copyright © 1998-2009 Dilvan Moreira