How to install Eclipse 3.7 on Ubuntu 11.04

The Eclipse packages in Ubuntu are are very out of date. The latest version in the Ubuntu repos is 3.5.2 where as the latest version of Eclipse is 3.7. I’m posting this because Ubuntu 11.04 uses the new Unity desktop which uses overlay-scrollbars (scrolls bars that are hidden until you hover over them). For some reason Eclipse 5.3.2 doesn’t like to play nice with the overlay scrollbars, and I’d rather use the newest version anyways. With Eclipse, you can just download the tar.gz file from eclipse.org and run it no problem, but I like set things up in a cleaner fashion, so here’s how I did it.

1) Download Eclipse. I got eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz

2) Extract it

tar xzf eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz

Or just be lazy and Right Click > Extract Here

3) Move to /opt/ folder

mv eclipse /opt/
sudo chown -R root:root eclipse
sudo chmod -R +r eclipse

4) Create an eclipse executable in your path

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

copy this into nano

#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"

$ECLIPSE_HOME/eclipse $*

save the file (^O = Ctrl+o) and exit nano (^X = Ctrl+x)

5) Create a gnome menu item

sudo nano /usr/share/applications/eclipse.desktop

copy this into nano

[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

save and exit nano

6) Launch Eclipse for the first time

/opt/eclipse/eclipse -clean &

180 Comments on “How to install Eclipse 3.7 on Ubuntu 11.04

  1. Thanks alot man.
    I switched to Ubuntu recently.

    Your walkthrough helped me a lot to install eclipse in a “Natty Narwale” style ;)

    • bash: /opt/eclipse/eclipse: cannot execute binary file

      I got that error message after following all the procedure!

        • Got the same error, no permission problems. Can’t figure out whats wrong.

      • It’s highly probable, that you are using x86 system and try to use x64 eclipse. Download eclipse version form Linux 32 Bit instead of 64 Bit – it should help.

  2. Hello, I will give it a try. One small correction: The Ubuntu version is 3.5.2 not 5.3.2. I just updated from 10.04 -> 10.10 -> 11.04. Now my Eclipse projects are hosed. So, I’m going to follow your instructions here. Thanks for doing the hard work!

  3. Hey, once again thanks for the info. I finally ended up creating a new VM with 10.04. I found 11.04 would not change the monitor correctly. I went back to this page since I do want to use the latest eclipse. I actually used eclipse for work back in 2005. Now I just want to do some Android work. Here is a site I found somewhat true: http://www.ihateeclipse.com/

  4. Thanks very much. It works a treat. I am using Ubuntu 11.04, is there anyway to make the launch bar icon change from the question mark to the actual eclipse icon.

    • Did you create this file “/usr/share/applications/eclipse.desktop”? Because in there you set the icon with the line “Icon=/opt/eclipse/icon.xpm”

      • Hmm, I’m also running 11.04 and the Unity desktop and the icon doesn’t display for me also.
        Also, what is the ‘# export MOZILLA_FIVE_HOME …’ line for? Isn’t this a comment? I’ve left it out …
        Best wishes
        J.

        • Correction. My version is 11.10.
          Having a trawl around there seems to be lots of discussion about changing launcher bar in Unity – the different solutions often seem to be deprecated, such as right clicking the desktop. I think this may have to wait a while …

          • Fixed. This is working in Unity on Ubuntu 11.10.
            I set the environment variables in /etc/environment
            MOZILLA_FIVE_HOME has something to do with Eclipse SWT, not sure what though.
            Didn’t use categories tag in .desktop file.
            The icon wasn’t showing at first because I’d moved eclipse into the wrong directory.
            See https://help.ubuntu.com/community/EclipseIDE
            thx

  5. It say it can’t find the file “mv: cannot stat `eclipse’: No such file or directory” where should the file be? I have try everything and it doesn’t work. Please Help! And Thanks anyone who help :)

  6. Pingback: How to install Eclipse 3.7 on Ubuntu 11.04 | Kavin-Zhao

  7. Should the first line in Step #3 be:
    sudo mv eclipse /opt/

    Thanks for the clear step-by-step!

  8. Hi,

    Will this setup work on 10.04? I am using 10.04 and the only place it is creating problem is in creating the gnome menu item. It says the file does not exists.

  9. I follow your instructions but I still couldn’t run eclipse.How can I manually remove it so I can reinstall it again.

  10. Just a quick comment – you might want to include ‘sudo’ in step 6.

    i.e. “sudo /opt/eclipse/eclipse -clean &”

  11. Woops, it seems I missed a step! No need for the sudo :) You may need some extra ‘cd’ commands though to go from (presumably ‘/home//Downloads’ to ‘/opt’ for the modifications to ‘/opt/eclipse’

  12. thanks man you are the guy thanks now i want to know if u can help me again installing the netbeans it says no JVM found… but i have already installed the JDK7…. some help please?

  13. Ok. I did it. I just don’t understand why the ownership has to go to root. I can’t even enter the folder after I did that. Can anyone explain please. Everybody is very happy. Probably I just don’t get it. :(

    • I saw it. I had to do
      sudo chmod -R +x /opt/eclipse/
      so now I can access it and use my eclipse and root is the owner.
      I kinda got the idea. Now I can only read and execute eclipse, cannot change anything in it , therefore crash it bigtime i suppose.

      Thanks for the tutorial :) learned a lot from it :)

  14. Thanks a lot! Everything’s fine, the only suggestion is to use “sudo mv eclipse /opt/” except “mv eclipse /opt/” (I’ve tried on Linux Mint 11).
    Thanks to you, now I can try Java 7 in Eclipse (earlier it was impossible, even though I had installed both openjdk 7 and Oracle jdk 7 and set one of them as default JRE, but couldn’t set “compiler compilance level” to a higher value then 1.6).

    • Just delete the directory /opt/eclipse/

      You should also nuke
      /usr/share/applications/eclipse.desktop
      /usr/bin/eclipse

      for a cleaner removal

  15. Thanks for this guide, I was wondering, is it possible to have 32bit eclipse version next to a 64bit version? I think it can, but what lines do I need to replace?

    Just the “eclipse” lines to “eclipse32” ?

  16. Thank you so much, It worked fine, thanks a lot friend

  17. Again, thank you. Too bad there is not an Eclipse repository that would simplify this.

  18. This tutorial was instrumental in my learning some basic Linux and bash functions. I kept having errors when I would try to install plug-ins, until I changed ownership of the /opt/eclipse folder from root to my user. The error that Eclipse gave me appeared to have nothing to do with ownership, but said that certain Maven dependencies could not be found. I was able to confirm that the dependencies actually were installed. Finally, it occurred to me that maybe Eclipse was looking for those dependencies in the root folder, rather than the opt/eclipse folder. The program installs plug-ins without a hitch after that change.

    I have seen other advice to install Eclipse in the home directory, which could have the benefit of not having to navigate around ownership issues.

    Thanks for the tips. No longer intimidated by the bash!

    Ric

  19. Hi. Thank you very much. It really helps a lot. I didi it. Would you please let me know how you have learned all these codes?
    Best Regards

  20. I have a problems in last stage.
    when a run a command.
    ‘/opt/eclipse/eclipse -clean &’
    I found
    ‘/opt/eclipse$ /opt/eclipse/eclipse
    bash: /opt/eclipse/eclipse: cannot execute binary file’
    what is solution for this?

  21. Hi. First thank you for tutorial, but I have this problem and i don’t know how to solve it when I execute the desktop file :S

    A Java Runtime Environment (JRE) or Java Development Kit (JDK)
    must be available in order to run Eclipse. No Java virtual machine
    was found after searching the following locations:
    /opt/eclipse/jre/bin/java
    java in your current PATH

  22. I’m on Ubuntu 11.10 and followed all steps in the original post. The application icon shows up under the Dash home’s More Apps menu, and can be run that way or from the terminal. Unfortunately, when I run it either way, Eclipse doesn’t show up in the side bar, and can’t be alt-tabbed to either (but Eclipse is running and I can click into it and do work). Any ideas, or was I not making sense?

Leave a Reply to bl Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.