Eclipse is an extensible, open source IDE (integrated development environment). It is completely platform and language neutral. In addition to the eclectic mix of languages supported by the Eclipse Consortium (Java, C/C++, Cobol), there are also projects underway to add support to Eclipse for languages as diverse as Python, Eiffel, PHP, Ruby, and C#. As the installation process of the required tools is somewhat tricky, this articles describes, step by step, how to install and configure a stable development environment using the Eclipse Workbench on Linux running on IBM pSeries™.
All work at Eclipse is done in sub-projects and components organized under top-level projects. The Eclipse Project is structured into the projects shown in Figure 1:
Figure 1. Eclipse top-level projects

Table 1 describes the three Eclipse top-level projects:
Table 1. Descriptions of the Eclipse top-level projects
| Projects | Description |
|---|---|
| Platform | The platform upon which all other Eclipse-based tools are built |
| JDT | The Java development tooling, or Java IDE |
| PDE | Plug-in development environment |
Table 2 lists the sub-projects of the Platform project:
Table 2. Components of the Platform project
| Sub-projects | Description |
|---|---|
| Ant | Ant Java-based build tool |
| Compare | Universal compare facility |
| Core | Core libraries |
| Debug | Universal debugger |
| Doc | Documentation |
| Help | Help system |
| Releng | Release engineering |
| Scripting | Scripting support |
| Search | Integrated search facility |
| SWT | Standard Widget Toolkit |
| Text | Text editor framework |
| UI | User interface libraries |
| Update | Dynamic update/install/field service |
| VCM | Versioning and configuration management |
| WebDAV | WebDAV integration |
Table 3 lists the sub-projects of the JDT project.
Table 3. Components of the JDT project
| Sub-projects | Description |
|---|---|
| JDT Core | Compiler and Builder |
| JDT Doc | Documentation |
| JDT UI | Java IDE user interface |
| JDT Debug | Debug support for Java |
| CDT | C/C++ compiler and builder |
Table 4 lists the sub-projects of the PDE project.
Table 4. Components of the PDE project
| Sub-Projects | Description |
|---|---|
| PDE build | PDE build |
| PDE Doc | Documentation |
| PDE UI | PDE user interface |
To introduce the usage of Eclipse, this article demonstrates how to develop simple Java and C/C++ projects as a starting point.
This section shows the procedures for downloading Eclipse, installing its prerequisites, and installing Eclipse itself. There are two supported Linux distributions on IBM pSeries, SUSE Linux Enterprise Server (SLES), and Red Hat Enterprise Linux Advance Server (RHEL AS or RHEL). There are some small differences in the Eclipse installation procedure between these two versions. The distributions used here are SLES, Version 9, Service Pack 3 (SLES9 SP3) and RHEL, Version 4, Update 3 (RHEL4 U3).
Before downloading and using Eclipse, read and agree to the Eclipse user agreement. Now you can download the Eclipse program.
From your Web browser, go to eclipse.org, and click on the download tag. You will see a Web page similar to the one shown in Figure 2:
Figure 2. Download page for Eclipse SDK package

Click on Eclipse SDK 3.1.2, and a page with download sites is presented to you. Choose a site physically nearest to you, and choose a directory in which to save the SDK, such as /tmp.
The download page automatically recognizes the platform to which you are downloading; you are downloading the Linux on POWER binary if your Web browser is running on a Linux on POWER machine. If you decide to download the Eclipse application to your Windows workstation and then copy it to a Linux on POWER machine, please note that you are downloading the Windows version by default. To select the Linux on POWER version manually, click on Other downloads for 3.1.2, and then select Linux (PPC/GTK2).
On a machine with SLES9 SP3 installed, two packages are required for Java development -- IBMJava2-JRE-1.4.2-0.55.ppc and IBMJava2-SDK-1.4.2-0.55.ppc. They are not automatically installed by the default Linux OS installation. These two packages are in SLES9 SP3 CD #2.
Use the rpm utility to install these two packages:
# rpm -Uvh IBMJava2-JRE-1.4.2-0.55.ppc.rpm # rpm -Uvh IBMJava2-SDK-1.4.2-0.55.ppc.rpm |
For C/C++ development in SLES9 SP3, gcc and gcc-c++ rpms must be installed. They require three packages -- glibc-devel-2.3.3-98.61.ppc.rpm and cpp-3.3.3-43.41.ppc.rpm, which can be can found on SLES9 SP3 CD #1, and libstdc++-devel-3.3.3-43.24.ppc.rpm on SLES9 CORE CD #2. To install these packages, use the following commands:
# rpm -Uvh glibc-devel-2.3.3-98.61.ppc.rpm # rpm -Uvh cpp-3.3.3-43.41.ppc.rpm # rpm -Uvh libstdc++-devel-3.3.3-43.24.ppc.rpm |
Now, you can install gcc and gcc-c++ in SLES 9 SP3. You will find their rpm packages on SLES9 SP3 CD #1. Install these packages like so:
rpm -Uvh libstdc++-devel-3.3.3-43.24.ppc.rpm rpm -Uvh libstdc++-devel-3.3.3-43.24.ppc.rpm |
For a machine with RHEL4 U3 installed, there are also two packages required for Java development -- compat-libstdc++-33-3.2.3-47.3.ppc, which can be found on RHEL4 U3 CD #3, and java-1.4.2-ibm-1.4.2.3-1jpp_14rh.ppc, which is on Application CD #1.
Use the following commands to install these two packages:
# rpm -Uvh compat-libstdc++-33-3.2.3-47.3.ppc.rpm # rpm -Uvh java-1.4.2-ibm-1.4.2.3-1jpp_14rh.ppc.rpm |
For C/C++ development in RHEL4, the gcc and gcc-c++ rpms require four packages -- glibc-kernheaders-2.4-9.1.98.EL.ppc.rpm, glibc-headers-2.3.4-2.19.ppc.rpm, glibc-devel-2.3.4-2.19.ppc.rpm, and libstdc++-devel-3.4.5-2.ppc.rpm. You will find all of these on RHEL 4 U3 CD #3. To install them, use the following commands:
# rpm -Uvh glibc-kernheaders-2.4-9.1.98.EL.ppc.rpm # rpm -Uvh glibc-headers-2.3.4-2.19.ppc.rpm # rpm -Uvh glibc-devel-2.3.4-2.19.ppc.rpm # rpm âUvh libstdc++-devel-3.4.5-2.ppc.rpm |
Now, you can install gcc and gcc-c++. Their rpm packages are also on RHEL4 U3 CD #3. Install them using the following commands:
rpm -Uvh gcc-3.4.5-2.ppc.rpm rpm -Uvh gcc-c++-3.4.5-2.ppc.rpm |
The procedures to install Eclipse itself are the same on both SLES9 SP3 and RHEL4 U3:
# cd /opt /opt # tar -zxvf /tmp/eclipse-SDK-3.1.2-linux-gtk-ppc.tar.gz |
Using Eclipse for Java development
This section demonstrates how a simple Java program can be developed in Eclipse. For more information on the features of the Eclipse SDK, please refer to the Help utility built in Eclipse.
-
Run the following command to start Eclipse:
/opt/eclipse/eclipse
-
Enter a directory where you want to store your projects. In Figure 3, /opt/eclipse/workspace is the directory:
Figure 3. Selecting the Eclipse workspace
-
You are presented with the Eclipse welcome page, as shown in Figure 4. On the menu bar, select File, New, and then Project.
Figure 4. Eclipse welcome page
-
The New Project window pops up, as shown in Figure 5. Click Next with Java Project selected.
Figure 5. Creating a new Java project
-
Type
MInfoin the Project name field, as shown in Figure 6, and click Next.
Figure 6. Entering your project name
-
Click Finish in the Java Settings window, as shown in Figure 7.
Figure 7. Accepting the default Java settings
-
Click on the WorkBench icon in the Welcome window, and the Eclipse Java perspective comes up with Package Explorer on the left and Outline windows on the right, as shown in Figure 8.
Figure 8. Java perspective
-
On the menu bar, select File, New, and then Class. A Java Class window pops up. Enter
MInfoin the Name field, as shown in Figure 9. Click Finish.
Figure 9. Creating a new Java class
-
A MInfo.java window is created. Copy the code in Listing 1 into the window, as shown in Figure 10. The code shows the machine's architecture (ppc64), operating system (GNU/Linux), and version of the Kernel (2.6.9-34.EL).
Listing 1. A sample Java programimport java.io.BufferedReader; import java.io.InputStreamReader; public class MInfo { public static void main (String args[]) { String cmd="uname -rpo"; String s=null; try { Process p = Runtime.getRuntime().exec(cmd, null, null); int i = p.waitFor(); if (i == 0){ BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); // read the output from the command while ((s = stdInput.readLine()) != null) { System.out.println(s); } } } catch (Exception e) { System.out.println(e); } } }
Figure 10. Creating a sample Java program
-
From the top menu bar, select File and Save to save the Java code onto the workspace directory (/opt/eclipse/workspace as defined in step 2, above).
-
If no syntax error is reported, with the Class MInfo highlighted in the Package Explorer on the left, select Run on the top menu bar, then select Run As, and Java Application, as shown in Figure 11.
Figure 11. Running the Java application
-
The program output (2.6.9-34.EL ppc64 GNU/Linux) is displayed in the console window, as shown in Figure 12.
Figure 12. Output displayed in the console window
This completes the development of a simple Java program.
Using Eclipse for C/C++ development
The C/C++ development environment for Eclipse, CDT, is not installed by default. This section introduces the steps to download and install CDT and describes the procedure to start a C/C++ project.
-
From the top menu bar, select Help, Software Updates, and Find and Install, as shown in Figure 13.
Figure 13. Start to install CDT
-
Select Search for new features to install in the Install/Update window, as shown Figure 14.
Figure 14. Searching for new features to install
-
Click on New Remote Site, as shown in Figure 15.
Figure 15. Selecting a remote site
-
Enter
CDT3.0in the Name field andhttp://download.eclipse.org/tools/cdt/releases/eclipse3.1as the URL, as shown in Figure 16. Then click OK.
Figure 16. Entering new remote site information
-
Check the check box next to CDT3.0, and then click Finish, as shown in Figure 17.
Figure 17. Selecting the search site
-
As the other mirror sites show up, highlight CDT3.0 and click OK, as shown in Figure 18.
Figure 18. Choosing CDT3.0 among the mirror sites
-
As the search on the site finishes, a window with all the updates available on the site appears. Check the checkboxes near Eclipse C/C++ Development Tools and Eclipse C/C++ Development Tooling SDK. Click Next, as shown in Figure 19.
Figure 19. Selecting packages/updates
-
Read the license agreement. If you agree with it, click I accept the terms in the license agreement, as shown in Figure 20, and click Next.
Figure 20. Read and agree to the License agreement
-
When the window, like that shown in Figure 21, appears, there should be two items under Features to install -- Eclipse C/C++ Development Tools 3.0.2 and Eclipse C/C++ Development Tooling SDK 3.0.2. Click Finish to start downloading components of CDT.
Figure 21. Starting to install CDT
-
When the download process finishes, click Install All in the Feature Verification window, as shown in Figure 22.
Figure 22. Installing the Eclipse C/C++ Development Tools feature
-
When the installation finishes, click Yes to restart Eclipse, as shown in Figure 23.
Figure 23. Prompt to restart Eclipse
Use Eclipse to develop a C/C++ project
-
When Eclipse restarts, select Window, Open Perspective, and then Other, as shown in Figure 24.
Figure 24. Opening a perspective
-
Highlight C/C++ and click OK, as shown in Figure 25.
Figure 25. Selecting the C/C++ perspective
-
Close the Welcome window. The C/C++ perspective appears with the C/C++ project navigator window on the left and the Outline window on the right. From the top menu bar, select New and Project, as shown in Figure 26.
Figure 26. Creating a new project
-
In New Project window under the C folder, select Managed Make C Project as shown in Figure 27, then click Next. The difference between Standard Make C or C++ Project and Managed Make C or C ++ Project is as follows:
- Standard Make C or C++ Project: You need to create a makefile or use an existing makefile in order to build your project.
- Managed Make C or C++ Project: A managed make project generates the makefiles for you automatically.
Figure 27. Selecting Managed Make C Project
-
Enter
minfoas the Project name and click Next, as shown in Figure 28.
Figure 28. Entering the project name
-
Select Executable (Gnu) as Project Type and click Next, as shown in Figure 29.
Figure 29. Selecting a type of project
-
Click Finish in the Additional Project Settings window, as shown in Figure 30.
Figure 30. Additional project settings
-
The minfo project is created in the C/C++ project navigator window on the left, as shown in Figure 31.
Figure 31. minfo project is created
-
From the top menu bar, select File, New, and then Source File, as shown in Figure 32.
Figure 32. Creating a new source file
-
Enter
minfo.cas the source file name, as shown in Figure 33, and then click Finish.
Figure 33. Entering the source file name
-
A minfo.c window appears in the middle. Copy the sample C code in Listing 2 into the minfo.c window, as shown in Figure 34.
Listing 2. A sample C program#include <stdio.h> #include <sys/utsname.h> int main (int argc, char **argv) { int i; struct utsname info[1]; i=uname(info); if (i==0) { printf ("%s %s %s\n", info->release, info->machine, info->sysname); return 0; } else { printf("uanme error !\n"); return i; } }
Figure 34. Creating a sample C program
-
From the top menu, select File and Save to save the source file. With minfo - [ppcbe] selected in the C/C++ project navigator on the left, select Run on the top menu, then select Run As and Run Local C/C++ Application, as shown in Figure 35.
Figure 35. Running the C/C++ application
-
The output of the program,
2.6.9-34.EL ppc64 Linux, is displayed in the console window, as shown in Figure 36.
Figure 36. Output displayed in the console window
This finishes the demonstration of creating a C project.
You learned how to install the prerequisite packages for the Eclipse SDK on two Linux distributions, SLES and RHEL, running on IBM pSeries. You also saw, step by step, how to download and set up Eclipse, and how to use Eclipse to create a Java project. Finally, you learned how to install CDT, the C/C++ development environment for Eclipse, and create, compile, and execute a simple C program.
Eclipse is the most comprehensive graphical development tool available on Linux on POWER. It gives you a universal user interface to develop applications using different programming languages. Moreover, since it is widely available on other operating systems and hardware platforms, your experience of building application on Eclipse will never expire. Give it a try today!
Learn
- Eclipse Web site: Find the latest news and information on the Eclipse project.
-
"Explore the new features of Eclipse V3.1" (developerWorks, February 2006): Find out what's new in Eclipse in this tutorial.
- Eclipse project resources: Find more articles and tutorials on Eclipse from the developerWorks Open source zone.
-
The Linux on POWER Architecture developer's corner provides a library of technical articles, access to discussion forums, links to training materials, and other resources for Linux on POWER developers.
- developerWorks Linux zone: Find more resources for Linux developers.
- Why Linux on POWER? answers that question and more for ISVs and IBM Business Partners.
-
Stay current with developerWorks technical events and Webcasts.
Get products and technologies
-
With IBM trial software, available for download directly from developerWorks, build your next development project on Linux.
Discuss
-
Check out developerWorks
blogs and get involved in the developerWorks community.
Calvin Sze is a Linux consultant for the IBM eServer Solutions Enablement organization at IBM, based in Austin, TX. Calvin’s main role is to help solution developers bring their applications to Linux on POWER. Calvin has been involved in software development and system integration on both Linux and AIX platforms for more than 10 years. You can contact Calvin at calvins@us.ibm.com.




