Friday, May 24, 2013

Setting up Eclipse in Ubuntu 12.10 in 10 steps


A quick post on how to set up Eclipse in Ubuntu 12.10


  1. Download your preferred version of Eclipse from http://www.eclipse.org/downloads/
    It is usually downloaded in the ~/Downloads directory, and the filename starts with "eclipse"

  2. Open a terminal window and go to the download directory
    Mine was:
    cd ~/Downloads

  3. Execute to untar (you can replace the "eclipse*" with the filename that you have downloaded):
    tar -zxvf eclipse*

  4. The previous step extracted a folder named "eclipse". Move this directory to /opt
    sudo mv eclipse /opt

  5. Execute to setup the permissions:
    sudo chmod -R +r /opt/eclipse
    sudo chmod +x /opt/eclipse/eclipse

  6. Append at the end of ~/.profile or ~/.bashrc the following. Execute first:
    gedit ~/.profile

    Then add the following line at the end of the file and save:

    # Eclipse environment variables
    export ECLIPSE_HOME="/opt/eclipse"
    export PATH=$PATH:$ECLIPSE_HOME

  7. Create a directory for the user shortcut:
    sudo mkdir /usr/lib/eclipse

  8. Then execute to set the shortcut:
    sudo ln -s /opt/eclipse/eclipse /usr/lib/eclipse/eclipse

  9. To create the menu icon, create a new file as follows:
    sudo gedit /usr/share/applications/eclipse.desktop

    Enter the following lines in the file and save:

    [Desktop Entry]
    Type=Application
    Name=Eclipse
    Comment=Eclipse Integrated Development Environment
    Icon=/opt/eclipse/icon.xpm
    Exec=/opt/eclipse/eclipse
    Terminal=false
    Categories=Development;IDE;Java;

  10. Run a clean for the first time:
    eclipse -clean

That's all! You will be able to start Eclipse from the terminal or from the Application menu!