For a quick tour of Eclipse, from installation to getting familiar with its most important features, we will use the Eclipse Classic package as our running example. Eclipse Classic contains the Eclipse Platform, Java Development Tools, and Plug-in Development Environment, including source and both user and programmer documentation.
What is Eclipse?
- Eclipse is an open source community, whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.
- Eclipse started with the Eclipse Project, which was originally created by IBM in November 2001 and supported by a consortium of software vendors. The Eclipse Foundation was created in January 2004 as an independent not-for-profit corporation to act as the steward of the Eclipse community. The independent not-for-profit corporation was created to allow a vendor neutral and open, transparent community to be established around Eclipse. Today, the Eclipse community consists of individuals and organizations from a cross section of the software industry.
- Concerning its support for IT infrastructure, the Eclipse Foundation manages the Eclipse open source community, including CVS/SVN code repositories, Bugzilla databases, development oriented mailing lists and newsgroups, download site and web site. The infrastructure is designed to provide reliable and scalable service for the committers developing the Eclipse technology and the consumers who use the technology.
Prior to Eclipse PDT installation, the user must have a copy of the Java Development Kit JDK installed on his/her machine.
Download the latest release of the JDK at: http://www.oracle.com/technetwork/java/javase/downloads/index.html.
A Java Runtime Environment (JRE) will do it, too. However, the JDK supports other Java-based applications (for example Greenfoot) in which you might be interested.
The Eclipse PDT download website is http://eclipse.org/downloads/. Near the top of the page will be a link called Eclipse Classic 4.2. This is the link that we need to download the latest version of Eclipse, which as of July, 2012 is Called Juno. 3r
- Extract the content of the Eclipse zip file with 7-Zip or other archiving program. As a result, you will obtain a directory hierarchy of folders and files.
- Move the entire directory to a proper location. For example, C:\Program Files\Eclipse is a good place.
- Eclipse Classic package, like other Eclipse downloads, does not install itself to your machine. The main Eclipse application, eclipse.exe, is located in the top-level directcory of the Eclipse distribution
- Create a shortcut for the eclipse.exe application and place the it on the desktop or Start menu.
No Java Virtual Machine (JVM) found to run Eclipse
StackOverflow has an extensive and recent discussion thread on this topic at http://stackoverflow.com/questions/2030434/eclipse-no-java-jre-jdk-no-virtual-machine.
The workbench refers to the desktop development environment. The Workbench aims to achieve seamless tool integration and controlled openness by providing a common template for the creation, management, and navigation of workspace resources. Each Workbench window contains one or more perspectives, and more than one workbench window can exist on the desktop at any given time.
Perspectives define the initial set and layout of views in the Workbench window. They provide a set of functionality aimed at accomplishing a specific type of task or working with specific types of resources. A Perspective assists the developer in three ways:
- Determines which views automatically display on the workbench.
- Determines the default layout of the views.
- Determines which commands appear on the main toolbar and certain menus.
To choose between different perspectives while working in Eclipse, choose Window -> Open Perspective from the menu bar. You are then presented with a choice of perspectives. You might also wish to customize or create your own perspective after modifying the layout of the Eclipse workbench. For example, if we wanted to always see a "search" view when loading the PHP perspective, the first thing to do is add it, which is done by:
- Off the menu bar, select Window -> Show View -> Other...
- Expand the "General" folder from the tree structure, and then select "Classic Search" and press OK.
- Next, in order to affect a change in the perspective, off the menu bar select Window -> Save Perspective As. To influence the behavior of an existing perspective, select it from the list of perspectives and save. Otherwise, you may type in a new name into the text box and create your own.
Views support editors and provide alternative presentations as well as ways to navigate the information in your Workbench. For example, the Project Explorer, also called the Navigator, and other navigation views display projects and other resources that you are working with. Essentially, views enable the user to see different aspects of their project.
When working with the workbench, there are two main regions with which we concern ourselves: the first is the center area, used for editing files (called the editor), and the areas along the outside of the editor, where the views are displayed. See the screenshot below for a better depiction.
Views have their own menus. To open the menu for a view, right-click the icon at the left end of the view's title bar. Some views also have their own toolbars. The actions represented by buttons on view toolbars only affect the items within that view.
A view might appear by itself, or stacked with other views in a tabbed notebook. You can change the layout of a perspective by opening and closing views and by docking them in different positions in the Workbench window.
Walkthrough of Basic Features
I suggest taking the Eclipse video tutorial at http://eclipsetutorial.sourceforge.net/workbench.html to get you up to speed with the wide range of functionality that Eclipse offers as an integrated development environment. Even though the workbench tutorial uses a Java version of Eclipse, the demonstration applies to all versions of Eclipse. Following along with the tutorial should assist you with learning:
- How to organize the Eclipse workbench to suit your needs
- How to customize the Eclipse layout and to use and customize perspectives and views
- How to use the Eclipse Compare editor to compare versions of files and similar files
- Useful keyboard shortcuts and other tips and tricks
Directions for downloading the 6-part video tutorial:
- Visit http://sourceforge.net/projects/eclipsetutorial/files/Eclipse%20Workbench/Version%201.0/
- Download and extract the workbench-lesson01-06 files (they're separate links) somewhere convenient. Each lesson extracts a .html file and a .swf file. If you run the .html file, it should play the flash video from within the browser.
- Download the workbench-tutorial-companion-document.pdf file and the workbench_tutorial.zip file. Do not extract the zip file. The pdf file is used as a reference document. The workbench_tutorial.zip file is imported into Eclipse by selecting File -> Import... Next expand the "General" drop down folder to select Existing Projects into Workspace. Next, select an archive file, and browse to workbench_tutorial.zip's location. Last, select finish.
Create a CIS505 Class Folder
Create a new project within your workspace:
- In Eclipse, click File -> New -> PHP Project.
- The "New PHP Project" window displays.
- In the "Project Name" field enter cis505 and click Finish.
The second step is to setup an alias for the cis505 folder. We have already defined how to setup an alias on the Apache page.
Now we must map to a path to this folder for the server:
- While in Eclipse, select off the menubar Window -> Preferences
- From the tree menu, expand PHP, then select PHP Servers.
- Click the "Default PHP Web Server" and click the edit button.
- Select the Path Mapping tab, and then click the Add button.
- For the Path on Server, type \devel\web (This is provided you are running Eclipse off the same USB drive as your workspace/document root folder. If you have Eclipse running on your hard drive and your USB storage device is where your workspace folder is located, then you need to specify the absolute location of your workspace, so be sure to include the correct drive letter.)
- For the Path on Workspace, type /cis505.
Create a Project from Existing Source Code
We'll use the Ronald McDonald House project to create a new project within Eclipse of an existing code base.
- Using the Eclipse Workbench: http://eclipsetutorial.sourceforge.net/workbench.html
- Eclipse installation tutorial, explanation of features and benefits: http://www.youtube.com/watch?v=TXmnoTN0jlQ