Wednesday, November 28, 2012

Eclipse in ubuntu

There are so many posts out there on installing eclipse on Ubuntu, that I decided to take the plunge. I had been troubled by having to manage two repos, but since I mainly use PyDev and Android SDK, neither of which are in the Ubuntu repository, so it was either deal or try to go it alone. I'm happy to report that eclipse 4.2, aka juno, is running great in Quantal, no errors so far!

With Oneiric and Precise I had successfully used both Ubuntu and eclipse repositories, but with each upgrade there were always snafus; I would have to re-install some plugin and end up losing my workspace settings. Playing the repo shuffle, you never know when Ubuntu might suddenly decide to revoke or add a package, and there are so many eclipse plugins it just makes sense to me to let one system manage the dependencies. Reading up a bit here and there I began to realize that this is an issue eclipse and Linux users have addressed and that eclipse would work out of the box on Ubuntu.

So the first thing I did was completely remove eclipse from my system. I had some false starts, first off Synaptic may be a great tool but it does not remove certain dependencies the same way as the Ubuntu Software Center (USC). Same goes for `apt-get`. Too bad because using USC is slow and tedious because you can only install/remove one package at a time. But unless you want to leave a lot of detritus on disk USC does a better job at killing off orphans. That made me realize another reason for installing eclipse as add-on software, since using the Ubuntu repo installed over 100 packages! I'm trying to keep my machine uncluttered and organized so that's just ridiculous.

I did a few things different than the vast number of sites posting instructions.
  1. I created a folder called "/opt" in my home directory and untarrred my eclipse download there. I chose the Java EE version for 32-bit Linux because it has the most complete selection of useful plugin preinstalled. I decided on ~/opt instead of /opt because I'm the only user and I didn't want to deal with ownership and permissions. This is a nice compromise that doesn't clutter your system. However, in general I would recommend copying the entire package to /opt and changing ownership to root:root.
  2. I created a soft symlink to ../opt/eclipse/eclipse called "eclipse" in ~/bin. This folder is already present and is always first on your path. If I had moved eclipse to /opt, then it would be available to all users, and then each user could create a symlink from there to their private ~/bin folder. I didn't have to change the permissions, because it's already 777.
  3. This next step is the major difference between what I did and what I've seen posted everywhere. I created a desktop file in ~/.local/share/applicatons called "eclipse.desktop" with the following. I looked into both gnome-panel and alacarte (ne main menu), but I ruled them out because the desktop file is so easy to create, and both of these tools are for true gnome desktops not Unity, and also seemed outdated. There is ample help on putting applications in the desktop. A couple of notes: ~ is not expanded, so use your complete path, X-Ayatana is the name of the Unity group, if you want to add extra commands and I had to export the eclipse xpm icon as a png file because it didn't work in the Unity dash.

    [Desktop Entry]
    Version=1.0
    Name=Eclipse
    GenericName=IDE
    Exec=/home/marko/bin/eclipse
    Terminal=false
    Icon=/home/marko/opt/eclipse/icon.png
    Type=Application
    Categories=Development;IDE

  4. I started eclipse from the dash and pinned it to the launcher. Then followed the customary procedures to update and install packages from within eclpse. From the menu select help > check for updates, and then help > install new software. Note: I have started help using the internal browser (default) and it works fine. My system already has both libwebkitgtk-1.0.0 and libwebkitgtk-3.0.0 so I didn't have to install or remove anything; eclipse help just worked out of the box. I have read numerous reports regarding this issue (eclipse crashes when help window opened), so evidently it has been solved.
So there you go. If you are on the fence, and tired of managing two repositories, I hope I've convinced you that it's okay to install eclipse as an add-on and it will work fine, and not break your system.

No comments:

Post a Comment

Fork me on GitHub