Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Getting Started with the Eclipse Workbench : Page 3

If you think an open source product like the Eclipse Workbench is necessarily Spartan and unassuming, think again. With a collection of great UI features, Eclipse may be good enough to make you wrinkle your nose at your current IDE. Get a look at what you're missing.


advertisement
Creating and Running a Java Program
Now that you understand how the different views in perspectives work together to allow you to perform a task, let's take Eclipse out for a spin by writing and running a traditional "Hello, world" program.

Before you can do anything else in Eclipse, such as creating a Java program, you need to create a project. To create a new Java project, follow these steps:

  1. Right-click in the Navigator view to bring up a context menu and select New > Project.
  2. In the New Project dialog box, Eclipse presents the project options: Java > Plug-in Development, and Simple. Because you want to create a Java program, select Java on the left side of the dialog box.
  3. Select Java Project on the right. If you've installed other types of Java development plug-ins, various other types of Java projects may potentially be listed here (EJBs and servlets, for example). But the JDT that comes standard with Eclipse only offers support for standard Java applications, so you must choose the Java Project option.
  4. Click Next to start the New Java Project Wizard.
  5. The first dialog box prompts you for a project name. This is a simple "Hello, world" example, so enter "Hello." Clicking Next would take you to a dialog box that lets you change a number of Java build settings, but for this example you don't need to change anything.
  6. Click Finish.
  7. Eclipse notifies you that this kind of project is associated with the Java perspective and asks whether you want to switch to the Java perspective. Check the "Don't Show Me This Message Again" box and click Yes.

The perspective changes to a Java perspective (see Figure 2). Notice that the view in the upper-left corner is no longer the Navigator view; it is now the Package Explorer view, and it displays the new Hello project. The Package Explorer is similar to the Navigator, but it's better suited for Java projects; for one thing, it understands Java packages and displays them as a single entry, rather than as a nested set of directories. Notice also that a new icon has appeared on the left edge of the Workbench: a shortcut for the Java perspective.



Figure 2. The Package Explorer View: This perspective is better suited for Java projects because it displays Java packages as a single entry instead of a nested set of directories.
At the bottom of the window is a Tasks view. It is useful for keeping track of what needs to be done in a project. Tasks are added to this list automatically as Eclipse encounters errors in your code. You can also add tasks to the Task view by right-clicking in the Tasks view and selecting New Task from the context menu; this is a convenient way to keep a to-do list for your project.

Finally, notice the Outline view on the right side of the screen. The content of this view depends on the type of document selected in the editor. If it's a Java class, you can use the outline to browse class attributes and methods and move easily between them. Depending on whether the Show Source of Selected Element button in the main toolbar is toggled on or off, you can view your source as part of a file (what is sometimes referred to as a compilation unit) or as distinct Java elements, such as methods and attributes.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date