Introduction to Eclipse

INTRODUCTION

Eclipse is open source software that provides an integrated development environment for JAVA. The software produced by the Eclipse Project is governed by the Common Public License. You may download this software for use on your computer. Note that version 2.1 is being used in the Penn State Harrisburg labs.

Prior to installing eclipse, you MUST install JAVA on your system. Eclipse will find it during installation.


    Eclipse WebSite
    Download JAVA (SDK 1.4.2)
    THE WORKBENCH

    The workbench is the integrated development environment that is part of Eclipse. You will develop your programs within this environment.

    CLICK on the Eclipse icon to open Eclipse. A screen, similar to the one on the right, will appear

    • Eclipse refers to various open projects or resources as "perspectives." You may open more than one perspectives at any one time.

    • The name of the active perspective appears in the titlebar. In this case you will probably see the words, "Resource" in the titlebar.

    • As you proceed, you may need to change perspectives (i.e. the workbench views). You can do this by clicking Window/OpenPerspective and then choosing the perspective desired.

    Note: The Navigator, Tasks and Outline "views" are open.



    Change to the JAVA Perspective (see last paragraph) and CLICK ON:

    • File

    • New

    • Project

    • Select Java on the left of the screen

    • Select Java Project on the right hand side of your screen.

    • Click on the Next Button

    • Insert a Project Name in the appropriate space.

    • Ensure that the "Use Default" is NOT checked.

    • Browse to a desired directory for your project.

    • Click on the Make New, i.e. if you are creating a new folder. Otherwise, merely select the folder desired.

    • Fill in your Project Name

    • Click on OK

    • Click on the Next Button

    • Click Finish

    A Java Project is created with the New Project Wizard.



    CREATE A PROJECT CLASS FILE:

    • File

    • New (make certain that the desired Project is selected)

    • Class

    • Insert a Package Name under the displayed Class Name. Package names are normally lower case and the same name as the primary class file.

    • Click on the Next Button

    • Insert a Project Name in the appropriate space.

    • Insert a Class Name in the appropriate space.

    • If this class is to drive the program (the main class), click on "public static class main..." Otherwise, do not check anything on the bottom of the form.

    • Click on Finish

    A Java class file is created with the New Class Wizard. You will be returned to the Eclipse WorkBench and the Java editor will be on the screen.



    BUILDING YOUR PROJECT

    • Select project from the Navigator Screen

    • Click on the Project Menu

    • Click on Rebuild Project

    Java byte code is created (or built). This is code that will be executed in the next step.


    RUNNING YOUR PROGRAM

    • Select project desired from JAVA applications listed on the left

    • Click on Run

    • Click on Run As

    • Select either "java applet" or "java application," depending on your application.

    This step runs or executes your program. If there is output, you will see it on the screen.



    CREATE ADDITIONAL CLASS FILES WITHIN PROJECT:

    • File

    • New (make certain that the Project created is selected)

    • Class

    • Insert the appropriate Package Name. This would be the same name as the one used for the other classes within your project.

    • Uncheck any package stubs that may be checked.

    A Java class file is created with the New Class Wizard. You will be returned to the Eclipse WorkBench and the Java editor will be on the screen.