[Work Notes] Eclipse IDE under Ubuntu

Most of the following content is adapted from online resources, with some corrections based on issues I encountered during setup. Ubuntu’s default Java environment uses GCJ-1.4, which has poorer performance. So the first step is to install the following packages using your preferred package manager (on Ubuntu, go to System → Synaptic Package Manager):

  • sun-java6-jre (required environment for running Java software)
  • sun-java6-jdk (needed only if you are a Java developer)
  • eclipse-jdt (Eclipse’s Java Development Tools package)
  • eclipse-common-nls (Eclipse’s localized language messages — install this for a Chinese interface)
  • galternatives (GUI frontend for update-alternatives, used to change system default preferences)

Edit the following file: vim /etc/jvm

/etc/jvm (defines the system JAVA_HOME):

  • Check or add the following at the top of the file:
    • /usr/lib/jvm/java-6-sun

Run Eclipse once and then close it to auto-generate the .eclipse/ directory in your home folder. Add the following content to ~/.eclipse/eclipserc (user-specific JAVA_HOME):

  • /usr/lib/jvm/java-6-sun

Check /etc/eclipse/java_home (defines the order in which Eclipse searches for JAVA_HOME):

  • Ubuntu 7.10: Already present — no action needed
  • Ubuntu 7.04: Manually add the following on the first line: /usr/lib/jvm/java-6-sun

Run the command: galternatives. In the application, scroll down to find the following three Alternatives: jar, java, javac. Set each option to one beginning with /usr/lib/jvm/java-6-sun/...

Verify by running this command in the terminal:

Open Eclipse and verify the JRE in use via:

[Help] → [About Eclipse Platform] → [Configuration Detail]

If you see multiple entries containing /usr/lib/jvm/java-6-sun-1.6.0..., you have successfully set up your Java & Linux development environment.


After completing the above, to achieve better development performance, you may also download the latest official Eclipse standalone release separately, extract it to a folder of your choice, and create a desktop shortcut.

To set up a C/C++ IDE environment, open Eclipse and go to:

[Help] → [Software Updates] → [Find and Install]

In the dialog, select “Search for new features to install”, then click Next.

In the Sites to include in search section, check Europa Discovery Site and tick Automatically select mirrors. Click Finish.

After a moment, expand the Europa Discovery Site menu, check C/C++ Development Tools, complete the installation, and restart Eclipse. You can now create C/C++ projects.


Comments & Feedback