Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
CarlosRoggan
Product and Topic Expert
Product and Topic Expert
5,062

Target group: everybody who is using Eclipse for the first time - and intends to use it for a long time…;-)

The reason why I am creating this document is that many users who want to try NetWeaver Gateway Productivity Accelerator (GWPA) have never used Eclipse before and will appreciate some help.

This document is related to the Prerequisites-document for the GWPA tutorials.

It contains a detailed description about how to install Eclipse and tries to give some background information about what is being done.

After having installed Eclipse, you might be interested in some tips&tips when working with Eclipse.

Installing Eclipse

If you’ve installed 64-bit-Java, you have to install 64-bit-Eclipse (otherwise you can’t start Eclipse, you’ll get an error popup with a JNDI-Error)

Note: In order to use GWPA, you have to install eclipse version 4.2.2, which is also known as code-name Juno.

Proceed as follows:

Download

Open the following link http://www.eclipse.org/downloads/packages/release/juno/sr2

The page lists pre-packaged eclipse installations. Basically, you could use any of them, but the recommendation would be:

Use Eclipse IDE for Java EE Developers If you plan to write web applications, or if you’re going to follow UI5 or HTML5 tutorials.

Use Eclipse Classic if you aren’t sure. You can add all other features anytime in the future.

On the details page, you’ll find the download link.

Choose the 32-bit or 64-bit version that matches your Java version.

Download it.

As a result, you have an archive on your local machine, e.g. eclipse-jee-juno-SR2-win32-x86_64.zip

Unzip it to a folder, e.g. C:\IDE

That’s all.

Installing Eclipse is as simple as unzipping a zip file.

Configuration

After installation of Eclipse and prior to the first start-up, you need a workspace.

This is a folder of your choice with a name of your choice and a location of your choice. The workspace will be used by Eclipse for storing its own metadata and the resources of the projects which are created in Eclipse.

E.g. if you create a Java application project, then the project and the Java files will be stored in the workspace.

Please consider choosing a workspace in a location that has write-access and better not use the “documents and settings” or “Program Files” folder (In the past, I heard about people having issues related to this location).

On start-up, Eclipse will ask for the location of the workspace, so better be prepared and have such a folder created in advance…;-)

See as well my Tips&Tips document about workspace setting.

Start-up

Now start Eclipse with double-click on the eclipse.exe file (located in your extracted “eclipse” folder)

Provide the workspace folder in the dialog that is displayed during start-up.

Understanding Eclipse

Once Eclipse is running, you can take a look around: open different Perspectives (Window -> Open Perspective) and different Views (Window -> Show View) and editors (double-click on files).

You’ll quickly learn the concepts of Eclipse.

Behind the curtain

What is Eclipse?

It is:

     Secondly:     a set of plugins

     Firstly:         a platform that manages the plugins.

The underlying platform is called Equinox and is an implementation of the OSGI-standard.

This means that after launching the framework/platform, the user is responsible for adding the desired components.

Examples:

     For writing Java-code, the user needs the set of plugins, which adds the Java development capabilities.

     If J2EE development is desired, just install the required plugins.

     If the user needs to measure code-coverage, he can simply add the "eclemma" plugins (for example) to Eclipse .

This is called pull-principle.

The disadvantage is that you have to take care of 1. knowing what you need (I agree: this is already a hurdle) 2. searching and 3. installing it.

The advantage is that you only install what you need.

There are more advantages, but such discussion is not intended within this document.

Regarding “platform”:

When you opened the page at http://www.eclipse.org/downloads/packages/release/juno/sr2 you’ve found not only the “naked” platform, but a list of “Packages”.

This is a convenient offering of pre-packaged Eclipse-installations, so-called “distributions”.

This way typically used development environments and functions are easier to download.

The "Eclipse Classic" package contains the "Java Development Tools" (JDT) which is used for Java development.

In front of the curtain

The most visible UI elements are:

  1. Views
    A "view" is a section in the Eclipse-IDE, which is responsible for displaying (i.e "viewing") information.
    Examples: the Project Explorer View, which displays the projects and resources of the Eclipse workspace in a tree.       
    The Console View, which displays the System Outs and logs.       
    The Error Log View, which allows to read the entries of the Eclipse-internal error log file.
    Anybody who wants to contribute to Eclipse can write his own view and add it to Eclipse, or he can add more capabilities to existing views (if supported).
  2. Editors
    An editor allows to modifying (i.e. "editing") of files, resources and other objects.
    An editor is always bound to a resource or any object living inside Eclipse.
    Examples:
         The Plugin Manifest Editor, which opens on the plugin.xml file and manifest.mf file
         The Java-Editor, bound to *.java files
         The OData Modeler, a graphical editor for OData Models, available on *.odata files
  3. Perspectives
    A perspective can be defined by developers to offer a single entry into their tool set.
    All views which are required for working with their tool set are coupled together into one “perspective” and can be altogether opened by opening that perspective.
    Example:
         When debugging a Java program you need the views for breakpoints, variables, stacktrace and console output.
         Instead of manually openingall these views one after the other, you can simply open the Debug Perspective.
    Even as an Eclipse user (not plugin-developer), you can define your own favorite perspective by opening and arranging your required views and then saving this arrangement by pressing
    Eclipse main menu -> Window -> Save Perspective As…

Installing additional software

How is additional functionality installed?

"Additional software" means "additional plug-ins".

In terms of OSGI, plugins are called “bundles”.

In order to add additional bundles, they have to be installed into the running Eclipse instance.

Since a tool is typically modularized and consists of multiple bundles, the amount of plugins in Eclipse can quickly raise to hundreds, even more than 1000 plug-ins are not unusual.

Therefore, bundles are bundled in so-called “features”.

A feature is described by an xml-file, that contains some meta-information and the list of bundles that belong to it.

Exercise

Have a look at a feature:

Go to the location, where you have extracted the downloaded eclipse-zip.

You’ll find a folder called "features".

Open it and you’ll see lots of folders, which are the features. Each folder contains at least a file feature.xml file.

Open such a file and you’ll see a list of plugins.

Note down one of the plugin-ids.

Go to the folder "plugins", which is on same level like the "features" folder.

Search for that plugin-id and you’ll find it: the plug-in that belongs to the feature.

OK, up to now we've learned about plug-ins and features.

But how to install them?

For convenience, the plugins and features can be installed from the internet.

This is not only downloading files, it is automatically downloading and installing.

Therefore, Eclipse requires an “update site”.

(To be more precise: the update site is not required especially by Eclipse, it is the mechanism defined by OSGi)

An update site contains the plugins and features and some meta-information.

A running Eclipse-instance can connect to such an updatesite and can “pull” the features and plugins from there.

Eclipse offers a wizard, which allows installing of features.

It is invoked via

main menu -> help -> install new software

Within this wizard, you enter the URL of an update site.

This can be a URL, or a local path on your local machine, or a local archive.

After entering the URL in the “Work with” field and pressing enter, Eclipse contacts the update site and reads the metadata in the site.xml file, which is located on the root level of the update site.

Afterwards, the wizard displays the content of the update site within the pane below.

It makes sense to leave the default selection of the checkboxes on the bottom half of the screen:

One if the settings is interesting: “Contact all update sites during install to find required software”.

The background:

You install the feature A because you want to work with it.

This feature uses API of a different library, which is available as a plugin P.

As such, the feature A has a dependency, which is declared in the <requires> section of the feature.xml file

During installation, Eclipse checks the dependencies recursively.

If a dependency is found, that is not available inside the Eclipse installation, or within the features that are being installed, Eclipse refuses the installation of feature A.

As such, you would have to install plugin P, in order to enable the installation of feature A.

In order to install plugin P, you have to add the update site, in which P is stored.

Then install the feature B, which contains plugin P

Then install feature A.

Eclipse makes this procedure easier:

When searching for dependencies, Eclipse can search not only the current installation and the update site of the feature being installed. Eclipse can also search all the update sites that are known (i.e. entered in the preference page “software sites”)

This makes your life easier, since you don’t have to read error messages about “unresolved dependencies” again and again. You simply don’t care about the dependencies.

Therefore, it is recommended to enable the check box “Contact all update sites”

If you like to explicitly be informed of what is being installed in your Eclipse, you can check what is installed in the following wizard page.

Example:

In the first Install wizard page, you’ve entered the SAP update site and chosen 2 features:

After pressing next, you can expand the feature nodes, in order to see the dependencies recursively:

You see that there’s a lot that is being installed under the hood.

In order to compare, go back to the first page, deselect the “contact all update sites” and press next: You’ll see the error message mentioned above.

Conclusion

I hope that this document has been able to help you to getting started with Eclipse, install it, extend is and understand it.

The next steps would be:

1. For a clearer and deeper understanding of what is going on under the hood, I recommend my OSGi document. It attempts to explain the most important terms of OSGi in short sections, it also provides a short reference of the most useful commands and it provides two exercises to get the hands dirty (here and here).

2. The usage of Eclipse strongly depends on the used tools. There are lots of tutorials which make use of Eclipse (which is the actual reason why I've written the current document). For example, the Java SE tutorial.