Section A.2. Getting Started with Eclipse


A.2. Getting Started with Eclipse

Let's get started. First, you'll need to install Eclipse. You can get Version 3.1 from the CD accompanying this book or you can download the latest version from http://eclipse.org/. Simply unpack the zip file to a location of your choice and then launch the application.

The first time you run Eclipse you'll be prompted to select a workspace. This is a root directory to hold new projects that you create within Eclipse. The default location is inside the application's folder itself, probably not what you want. Pick a location and click OK.

Eclipse greets you with the Welcome Screen. Close this window by closing the Welcome tab within the application. If you want to come back later and go through the Eclipse tutorials and related help topics, you can get this window back by choosing Help Welcome.

One last thing before we move on: Eclipse stores all of its configuration information in the configuration folder inside the Eclipse installation directory. If, at any point in this introduction, you feel that things are not right and you want to start from scratch, you can quit the application and remove this folder. You may also wish to remove your workspace items as they hold per-project state. Less drastically, if you wish to reset all of the application windows to their default locations, you can choose Window Reset Perspective. Well talk more about perspectives later.

A.2.1. Importing the Learning Java Examples

Before we talk about the IDE itself, let's load the examples from this book. You can find a ZIP file containing all of the examples from this book nicely packaged as an Eclipse project on the CD accompanying this book or at http://www.oreilly.com/catalog/learnjava3. The Eclipse version of the examples is called examples-eclipse.zip. (The file examples.zip holds the same examples but packaged slightly differently and without the Eclipse project files.)

First, create a new project to hold the examples using the File New Project menu item. In the New Project wizard, select Java Project as the project type and click Next. Give the project a name (we used LearningJava). The default location for the project folder will be in the workspace area that you designated earlier, but you can change this if you wish. Click Finish when youre done. (If Eclipse asks if you wish to set the "project compliance settings" to Java 5.0, you should answer Yes.)

Next, we'll import the examples zip file. Choose File Import to open the Import wizard. Select Archive File as the source and click Next. Click the Browse button and choose the eclipse-examples.zip file. Check the "Overwrite existing files without warning button so that our Eclipse-specific project file will overwrite the empty one in your new project. The Import wizard should look like Figure A-1 (we've expanded the folder tree so that you can see the examples). Click Finish.

Eclipse will now import all of the files from the archive and immediately begin building the source in the background (a small progress bar at the bottom of the screen will show this).



    Learning Java
    Learning Java
    ISBN: 0596008732
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net