How to install Eclipse?

If you've downloaded Eclipse from their official website, follow these steps for the installation.

  1. Extract the eclipse.XX.YY.tar.gz using

    tar -zxvf eclipse.XX.YY.tar.gz
    
  2. Become root and Copy the extracted folder to /opt

    sudo mv eclipse.XX.YY /opt
    
  3. Create a desktop file and install it:

    gedit eclipse.desktop
    

    and copy the following to the eclipse.desktop file

    [Desktop Entry]
    Name=Eclipse 
    Type=Application
    Exec=env UBUNTU_MENUPROXY=0 eclipse44
    Terminal=false
    Icon=eclipse
    Comment=Integrated Development Environment
    NoDisplay=false
    Categories=Development;IDE;
    Name[en]=Eclipse
    

    and make sure that it has executable permission, then execute the following command to automatically install it in the unity:

    sudo desktop-file-install eclipse.desktop
    
  4. Create a symlink in /usr/local/bin using

    sudo ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse44
    
  5. For eclipse icon to be displayed in dash, eclipse icon can be added as

    sudo cp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm
    
  6. Don't forget that you need to have either OpenJDK or Sun Java installed to be able to run eclipse. Check this question for more information about Java installation. Here is a simple example of installing Open JDK 1.6:

    sudo apt-get install openjdk-6-jdk
    
  7. Launch Eclipse and then give it the required permissions to modify the osgi file:

    sudo chown -R $USER:$USER /opt/eclipse/configuration/org.eclipse.osgi
    

    NB! You must launch Eclipse first, because the org.eclipse.osgi directory is created only after the first launch.

That's it.


The preferred method: Software Center

  1. In Ubuntu software center select Eclipse. I installed the Extensible Tool Platform and Java IDE as well, but installing that is optional.

    eclipse in software center

  2. Enter your password in the authentication dialog. This will get you 3.7.1 inside of a package management system.

The least preferred method: Portable

For a portable installation you can still download directly from the Eclipse website. This gives you the ability to customize several Eclipse installations for different languages CDT, Java, and PyDev or Aptana for instance. It doesn't allow automatic updates. Installing through Software Center is always the preferred method.

I tested the portable 3.7.1 and 3.7.2 tar balls and they work just fine on 12.04 LTS.

An added disadvantage to portable installs is that you have to update your launcher if you move the folder or launch it directly.


How to install Eclipse 4.2 on Ubuntu 12.04

Since the Eclipse packages in the Ubuntu repositories are out of date, if we want to install latest releases, we are going to have to do it manually. You can just download the tar.gz file from eclipse.org.

  1. Download Eclipse. I got eclipse-jee-juno-SR1-linux-gtk.tar.gz

  2. Extract it by executing a command line

    tar -xzf eclipse-jee-juno-SR1-linux-gtk.tar.gz
    

    Or with Archive Manager extraction.

  3. Move extracted eclipse folder to /opt/ folder

    mv eclipse /opt/
    sudo chown -R root:root /opt/eclipse
    sudo chmod -R +r /opt/eclipse
    
  4. Create an eclipse executable in your user path

    sudo touch /usr/bin/eclipse
    sudo chmod 755 /usr/bin/eclipse
    

    Create a file named eclipse in /usr/bin/ with your preferred editor (nano, gedit, vi...)

    Copy this into it

    #!/bin/sh    
    export ECLIPSE_HOME="/opt/eclipse"
    $ECLIPSE_HOME/eclipse $*
    

    And save the file

  5. Create a Gnome menu item

    Create a file named eclipse.desktop in /usr/share/applications/ with your preferred editor (nano, gedit, vi...)

    Copy this into it

    [Desktop Entry]
    Encoding=UTF-8
    Name=Eclipse
    Comment=Eclipse IDE
    Exec=eclipse
    Icon=/opt/eclipse/icon.xpm
    Terminal=false
    Type=Application
    Categories=GNOME;Application;Development;
    StartupNotify=true
    

    And save the file

  6. Launch Eclipse

    /opt/eclipse/eclipse -clean &

  7. Now you can Lock Eclipse to the launcher bar by clicking right button on Lock to Laucher