Using Eclipse

Red Hat Developer Tools 1.0

Installing Eclipse 4.7.0 and first steps with the application

Supriya Takkhi

Red Hat Developer Group Documentation Team

Abstract

Information for users installing and starting to use Red Hat Developer Tools.

Chapter 1. Eclipse 4.7.0

Red Hat Developer Tools, available for Red Hat Enterprise Linux 7, includes Eclipse 4.7.0, which is based on the Eclipse Foundation’s Oxygen release train. This integrated development environment was previously available as a part of Red Hat Developer Toolset. Note that rh-eclipse47 requires the rh-java-common collection.

Eclipse is a powerful development environment that provides tools for each phase of the development process. It integrates a variety of disparate tools into a unified environment to create a rich development experience, provides a fully configurable user interface, and features a pluggable architecture that allows for an extension in a variety of ways. For instance, the Valgrind plug-in allows programmers to perform memory profiling, that is otherwise performed on the command line through the Eclipse user interface.

Figure 1.1. Sample Eclipse Session

Sample Eclipse Session

Eclipse provides a graphical development environment alternative to traditional interaction with command line tools and it is a welcome alternative for developers who do not want to use the command line interface. The traditional, mostly command line-based Linux tools suite such as gcc or gdb and Eclipse offer two distinct approaches to programming.

For an overview to develop applications for Red Hat JBoss Middleware or for support for OpenShift Tools, see Red Hat JBoss Developer Studio.

Table 1.1. Eclipse Components Included in rh-eclipse47

PackageDescription

rh-eclipse47-eclipse-cdt

The C/C++ Development Tooling (CDT) that provides features and plug-ins for development in these two languages.

rh-eclipse47-eclipse-changelog

The ChangeLog plug-in that allows you to create and maintain changelog files.

rh-eclipse47-eclipse-egit

EGit, a team provider for Eclipse that provides features and plug-ins for interaction with Git repositories.

rh-eclipse47-eclipse-emf

The Eclipse Modeling Framework (EMF) that allows you to build applications based on a structured data model.

rh-eclipse47-eclipse-epp-logging

The Eclipse error reporting tool.

rh-eclipse47-eclipse-gcov

The GCov plug-in that integrates the GCov test coverage program with Eclipse.

rh-eclipse47-eclipse-gef

The Graphical Editing Framework (GEF) that allows you to create a rich graphical editor from an existing application model.

rh-eclipse47-eclipse-gprof

The Gprof plug-in that integrates the Gprof performance analysis utility with Eclipse.

rh-eclipse47-eclipse-jdt

The Eclipse Java development tools (JDT) plug-in.

rh-eclipse47-eclipse-jgit

JGit, a Java implementation of the Git revision control system.

rh-eclipse47-eclipse-manpage

The Man Page plug-in that allows you to view manual pages in Eclipse.

rh-eclipse47-eclipse-mpc

The Eclipse Marketplace Client.

rh-eclipse47-eclipse-mylyn

Mylyn, a task management system for Eclipse.

rh-eclipse47-eclipse-oprofile

The OProfile plug-in that integrates OProfile with Eclipse.

rh-eclipse47-eclipse-pde

The Plugin Development Environment for developing Eclipse plugins.

rh-eclipse47-eclipse-perf

The Perf plug-in that integrates the perf tool with Eclipse.

rh-eclipse47-eclipse-ptp

A subset of the PTP project that provides support for synchronized projects.

rh-eclipse47-eclipse-pydev

A full featured Python IDE for Eclipse.

rh-eclipse47-eclipse-remote

The Remote Services plug-in that provides an extensible remote-services framework.

rh-eclipse47-eclipse-rpm-editor

The Eclipse Spec File Editor that allows you to maintain RPM spec files.

rh-eclipse47-eclipse-rse

The Remote System Explorer (RSE) framework that allows you to work with remote systems from Eclipse.

rh-eclipse47-eclipse-systemtap

The SystemTap plug-in that integrates SystemTap with Eclipse.

rh-eclipse47-eclipse-valgrind

The Valgrind plug-in that integrates Valgrind with Eclipse.

rh-eclipse47-eclipse-webtools

The Eclipse Webtools plug-ins.

1.1. Enabling the Red Hat Developer Tools Repositories

To install Eclipse you must first enable the Red Hat Developer Tools repositories.

  • Enable the rhel-7-server-devtools-rpms repository on Red Hat Enterprise Linux Server or enable the rhel-7-workstation-devtools-rpms repository on Red Hat Enterprise Linux Workstation
  • Enable the rhel-server-rhscl-7-rpms reository
Note

Red Hat Developer Tools is not supported on the Client or the ComputeNode variant.

To enable the Red Hat Developer Tools repositories:

  1. Run the following commands as the root user:

    # subscription-manager repos --enable rhel-7-server-devtools-rpms
    # subscription-manager repos --enable rhel-server-rhscl-7-rpms
    Note

    In the above command, depending on the variant of Red Hat Enterprise Linux that you are using, Server or Workstation, the commands will be:

    • For the Workstation variant: subscription-manager repos --enable rhel-7-workstation-devtools-rpms
    • For the Server variant: subscription-manager repos --enable rhel-7-server-devtools-rpms

    For developers, we recommend using Red Hat Enterprise Linux Server for access to the widest range of development tools.

    For more information on registering and attaching subscriptions, see Using and Configuring Red Hat Subscription Management.

  2. To add the Red Hat Developer Tools key to your system, run the following commands as the root user:

    # cd /etc/pki/rpm-gpg
    # wget -O RPM-GPG-KEY-redhat-devel https://www.redhat.com/security/data/a5787476.txt
    # rpm --import RPM-GPG-KEY-redhat-devel

1.2. Installing Eclipse

The Eclipse development environment is provided as a collection of RPM packages.

  1. To install Eclipse, run the following commands as the root user:

    yum install rh-eclipse47

    For a list of available components, see Table 1.1, “Eclipse Components Included in rh-eclipse47.

Note

rh-eclipse47 fully supports C, C++, and Java development, but does not provide support for the Fortran programming language.

1.3. Using Eclipse

To start rh-eclipse47:

  1. Click Applications > Programming > Red Hat Eclipse, or type the following at a shell prompt:

    scl enable rh-eclipse47 eclipse
  2. During its startup, Eclipse prompts you to select a workspace that is a directory in which you want to store your projects. You can either use ~/workspace/, which is the default option, or click Browse to browse your file system and select a custom directory. Additionally, you can select the Use this as the default and do not ask again check box to prevent Eclipse from displaying this dialog box the next time you run this development environment.
  3. Click OK to confirm the selection and proceed with the startup.

1.3.1. Using the Red Hat Developer Toolset Toolchain

To use rh-eclipse47 with support for the GNU Compiler Collection and binutils from Red Hat Developer Toolset:

  1. Ensure that devtoolset-Developer Toolset 6-toolchain is installed and run the application as described in Section 1.3, “Using Eclipse”. The rh-eclipse47 Collection uses the Red Hat Developer Toolset toolchain by default.

For detailed instructions on how to install the devtoolset-Developer Toolset 6-toolchain package on your system, see Installing Red Hat Developer Toolset.

Important

If you are working on a project that you previously built with the Red Hat Enterprise Linux version of the GNU Compiler Collection, make sure that you discard all previous build results. To do so, open the project in Eclipse and select Project > Clean from the menu.

1.3.2. Using the Red Hat Enterprise Linux Toolchain

To use rh-eclipse47 with support for the toolchain distributed with Red Hat Enterprise Linux, change the configuration of the project to use absolute paths to the Red Hat Enterprise Linux system versions of gcc, g++, and as.

To configure Eclipse to explicitly use the Red Hat Enterprise Linux system versions of the tools for the current project:

  1. In the C/C++ perspective, click Project > Properties to open the project properties.
  2. In the menu on the left-hand side of the dialog box, click C/C++ Build > Settings.
  3. Click the Tool Settings tab.
  4. If you are working on a C project:

    1. Select GCC C Compiler or Cross GCC Compiler and change the value of the Command field to:

      /usr/bin/gcc
    2. Select GCC C Linker or Cross GCC Linker and change the value of the Command field to:

      /usr/bin/gcc
    3. Select GCC Assembler or Cross GCC Assembler and change the value of the Command field to:

      /usr/bin/as
  5. If you are working on a C++ project:

    1. Select GCC C Compiler* or *Cross G Compiler and change the value of the Command field to:

      /usr/bin/g++
    2. Select GCC C Compiler or Cross GCC Compiler and change the value of the Command field to:

      /usr/bin/gcc
    3. Select GCC C Linker* or *Cross G Linker and change the value of the Command field to:

      /usr/bin/g++
    4. Select GCC Assembler or Cross GCC Assembler and change the value of the Command field to:

      /usr/bin/as
  6. Click OK to save the configuration changes.

1.4. Additional Resources

A detailed description of Eclipse and all its features is beyond the scope of this document. For more information, see the following resources.

Installed Documentation

  • Eclipse includes a built-in Help system that provides extensive documentation for each integrated feature and tool. This greatly decreases the initial time investment required for new developers to become fluent in its use. The use of this Help section is detailed in the Red Hat Enterprise Linux Developer Guide linked below.

See Also

Chapter 2. Changes Since Red Hat Software Collections 2.4

Note

Earlier a part of Red Hat Software Collections, Eclipse 4.7.0 is now the first release that is distributed as a part of Red Hat Developer Tools.

Red Hat Developer Tools is distributed with Eclipse 4.7.0 and other plugins from the Oxygen release train, which provide a number of bug fixes and feature enhancements over the Red Hat Software Collections 2.4 version. Following is a comprehensive list of new features and compatibility changes in this release. For details on how to use these new features, see the built-in Eclipse documentation.

The following features have been added since the release of Eclipse platform and plugins included in Red Hat Software Collections 2.4:

  • Eclipse Platform has been updated to version 4.7.0 from 4.6.3. This is a feature release and it contains many bug fixes and optimizations including but not limited to:

    • A new extensible Generic Editor is added. This makes it easier to implement an editor for new languages or new content types. It reuses the existing Eclipse editor infrastructure. The generic editor can be extended using extension points instead of implementing an editor to supply the required functionality.
    • Updated API is more Java 8 friendly by allowing lambdas.
    • Support for defining GTK CSS either per component (runtime) or workbench (startup).
    • Console view integration with Error Log and JUnit views to allow easier plain text inspection of the content.
    • Eclipse Target definition editor is included.
    • Patch and diff file types editor is included.
    • Images are opened inside the IDE in Browser view by default to prevent interaction with external tools.
    • Left and right sides in Compare view are swappable.
    • New Launch Group launch configuration type allows you to launch multiple other launch configurations sequentially, with configurable actions after launching each group member.
    • Improved Quick Access view with more powerful matching, wildcards support, search in Help and other improvements.
    • The Left and Right arrow keys now collapse and expand the current tree item (in addition to the GTK+ default -/+ key bindings).
    • Improved recognizing of browsers available on the system - Firefox, Chromium/Chrome, Epiphany, Konqueror.
    • Default styling for form-based user interfaces was changed to use a flat, gray style.
    • Improved navigation to implementation for Java types.
    • Improved autoedit capabilities in Java editor - insert braces in correct places and auto-escape pasted text.
    • During Java debugging, the last method result (per return or throw) that was observed during Step Into, Step Over or Step Return, is shown as first line in the Variables view.
    • For detailed notes, see https://www.eclipse.org/eclipse/news/4.7/.
  • Eclipse CDT has been updated to version 9.3 from 9.2.1. This release includes a number of enhancements like:

    • Quick fixes have been added for a variety of build errors generated by the gcc compiler.
    • Support for two new C++14 language features has been added: return type deduction and generic lambdas.
    • Improved autocomplete and content assist.
    • Improved navigation for 'auto' types to open the deduced type.
    • For detailed notes, see https://wiki.eclipse.org/CDT/User/NewIn93
  • Eclipse Linux Tools has been updated to version 6.0 from 5.3.1. This release contains changes like:

    • Support for all the content types with specialized editors is hooked into Eclipse 4.7 new generic editor.
    • Editors (.stp, Dockerfile, .supp, .spec, ChangeLog) highlighting colors are no longer hardcoded but defined in the plugin.xml file via org.eclipse.ui.themes extension point.
    • Docker plugin gained support when launching commands in a Container to specify a security option profile.
    • Systemtap run console creates links for navigation to .stp or .h/c files if paths to them are printed during the run.
    • For detailed notes, see https://wiki.eclipse.org/Linux_Tools_Project/News/NewIn60
  • Eclipse Mylyn has been updated to version 3.23 from 3.21. Changes include:

  • Eclipse EGit and JGit have been updated to version 4.8 from 4.6.1 including changes like:

  • Eclipse DLTK have been updated to version 5.8 from 5.7.1 including changes like:

  • Eclipse Pydev have been updated to version 5.8 from 5.5.0 including changes like:

  • Eclipse Webtools have been updated to version 3.9 from 3.8.2 including changes like:

Chapter 3. Known Issues in Eclipse 4.7.0

This section details the Known Issues in Eclipse 4.7.0.

3.1. Debuginfo Conflicts

Cause: When a user attempts to install a debuginfo package for this collection, for example: rh-eclipse47-eclipse-cdt-debuginfo, the contents may conflict with the same packages from the earlier collections.

Consequence: The installation of the rh-eclipse47 debuginfo package may fail if the same debuginfo package from the rh-eclipse46 collection is installed.

Workaround: To use debuginfo for the rh-eclipse47 collection, debuginfo packages from the rh-eclipse46 collection should first be uninstalled using the command yum remove rh-eclipse46*debuginfo.

Result: The installation of the debuginfo packages from the rh-eclipse47 collection is successful.

3.2. Tycho Conflicts

Cause: The rh-eclipse47-tycho package conflicts with the same package from the earlier collections, for example: rh-eclipse46-tycho.

Consequence: The installation of rh-eclipse47-tycho package may fail when rh-eclipse46-tycho package is already installed.

Workaround: Note that tycho is only needed by users who want to build or re-build Eclipse or its plug-ins. If needed, the rh-eclipse46-tycho package should be uninstalled using the command yum remove rh-eclipse46-tycho before attempting to install the rh-eclipse47-tycho package.

Result: The installation of the rh-eclipse47-tycho package is successful.

3.3. Failure to Parse Debug Info on RHEL 7.4

Cause: An enhancement to the BFD library in RHEL 7.4 broke the code that parses debug information.

Consquence: This is known to affect the gprof and perf components of the rh-eclipse47-eclipse-linuxtools package by causing Eclipse to fail to attribute samples to the correct source.

Workaround: This problem is fixed in the base RHEL binutils package via a separate erratum. Erratum RHBA-2017:2577 should be installed to fix this problem.

Result: After erratum RHBA-2017:2577 is installed, the gprof and perf tooling within Eclipse starts working as expected.

3.4. Systemtap Conflicts on RHEL 7.4

Cause: rh-eclipse47 provides support for running systemtap scripts. When the devtoolset-6-systemtap package is present, it takes precedence over the systemtap package present in the base operating system. However, when on RHEL 7.4, the devtoolset-6-systemtap package incorrectly uses a subset of runtime files of the base operating system systemtap and fails to run properly.

Consequence: The output of the scripts may contain errors and warnings indicating that wrong systemtap runtime files were used.

Workaround: When using the systemtap package on RHEL 7.4, the devtoolset-6-systemtap package should be uninstalled using the command yum erase 'devtoolset-6-systemtap*'.

Result: rh-eclipse47 will then use the systemtap package present in the base operating system which works with rh-eclipse47 without known issues.

Legal Notice

Copyright © 2017 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.