6 Tips To Make Eclipse Lighter, Prettier And More Efficient

Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on LinkedIn

Let’s face it, Java has a bad reputation when it comes the tool chain. Eclipse is perhaps the poster child of the problem. Considered by many as one of the clunkiest, heaviest, least elegant IDE around, it fuels a nice love/hate symbiosis with developpers around the globe. The obvious alternatives, Netbeans and IntelliJ are far from perfect too, in arguably different ways, although flamewars have been fought to assert the superiority of each one other all the others.

Still, many of us have to stick with Eclipse, for good or bad reasons. But the situation doesn’t have to be as that as they say. Today we’ll give the poor dirty bastard a cold shower of style and minimalism:

4-eclipse

Tip #1: Package your own bare-bone Eclipse

This is the number one tip, and should you follow only one, read this. The biggest misconception about Eclipse comes from the fact it’s not actually an IDE. Eclipse is a platform designed to build IDEs, so a meta-IDE if you like. When you download one of the standard distribution (yes, even the most basic ones), you get everything you need, plus megabytes upon megabytes of frameworks, tools, interfaces, documentations, plugins, that are necessary to code extensions. You also get Mylyn, an exotic task/planning/bug manager, but i’ve yet to meet one single lifeform that had ever used it in real life.

99% of the people won’t ever need that stuff, yet everyone get it, store it, and run it every day. The madness must stop.

  • ¬†Download the eclipse runtime binaries. Currently the 4.x branch is a bit of a mess, so pick your favorite 3.x version here. Once you’re on the download page **do not download the first link**, that’ll be the “Eclipse SDK”, it’s about 180 Mb. Scroll down and get the platform binaries (only 50 megs!). Unzip the package and run Eclipse, it should take less than 4-5 seconds on a semi-decent desktop.
  • From the same page, download the language specific features you need. If you do java, that’ll be JDT link for 3.8.1. C/C++ ? CDT. Python ? Pydev. Again, when given the choice, chose the “runtime binaries”, not the SDK.
  • From within Eclipse, install the language specific feature (Help > Install new software > Add > Archive). Restart.
  • From now on, you’re free to install your “can’t live without” plugins. I added EGit, plus some others (more on that below).

There you go, a minimalist eclipse that starts much faster and consume much less RAM. This is a quick benchmark, made on i7 920, running Oracle JVM 1.6.21 on Ubuntu 12.04.
Startup times were measured by looking at eclipse inner log timestamps (-consoleLog switch in eclipse.ini), heap sizes were given by VisualVM. I averaged the numbers over 5 successive launches; this is not a seriously scientific benchmark, but it’s enough to demonstrate that there is indeed a very significative difference.

Default Eclipse – Java edition Bare bone Eclipse + JDT + EGit
Startup (small workspace, 3 projects) 4.3s 3.2s
Startup (large workspace, 51 projects) 11.7s 6.4s
Heap after startup + GC (used/size), small workspace 25 Mb/63 Mb 21 Mb/43 Mb
Heap after startup + GC (used/size), large workspace 90 Mb/254 Mb 49 Mb/240 Mb

Tip #2: VM arguments tweaks

Since your eclipse starts much faster, let’s switch the VM to server mode. The minimal extra startup cost will be compensated by better runtime performance and responsiveness. You do that by simply appending :

-server

at the end of your eclipse.ini.

Tip #3: Linux/GTK special make-up

One day, a co-worker told me he would switch to Linux (from Windows, the poor thing) when Eclipse will stop looking “gross”. The font and default space margins between UI elements were at fault. If you feel bothered by the waste of space (of course you are; look at those tabs!) an easy tweak can give Eclipse a much more compact look.

Copy-paste the following in a file named “gtkrc” at the root of your eclipse install dir.

style "compact"
{
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=1
GtkMenuItem::horizontal_padding=4
GtkToolbar::internal-padding=1
GtkToolbar::space-size=1
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkExpander::expander_size=10
GtkExpander::expander_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::expander-size=12
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0

font_name="Liberation Sans,Sans Regular 8"
text[SELECTED] = @selected_text_color
}
class "GtkWidget" style "compact"
style "compact2"
{
xthickness=1
ythickness=1
}
class "GtkButton" style "compact2"
class "GtkToolbar" style "compact2"
class "GtkPaned" style "compact2"

Then create this custom script to launch eclipse

#!/bin/bash
GTK2_RC_FILES=$GTK2_RC_FILES:/path/to/eclipse/gtkrc /path/to/eclipse/eclipse &

Tip #4: Color themes

It’s quite painful to tweak syntax color individually in Eclipse preferences, so most user keep the default boring settings. Well, Eclipse Color Theme plugin feature an one-click theme picker, with some awesome default ones.

Tip #5: Vrapper

If you invested time into learning vi commands, and miss the inline searches, the visual mode, the evolved text navigation, you’d be glad to know you can stop ranting on forums about the inferiorness of eclipse as a text editor, and use this wonderful plugin.

Between that and vimperator on firefox, you can virtually throw away your mouse.

Tip #6: Forget about the unecessary UI

It takes some training, but removing most of the distractions in the UI does wonder for concentration. You should give it a try; Hide the toolbars, close all the views but the package explorer and the text editors. If you need a quick look at the hidden panels, use these shortcuts:

  • Ctrl-F7 and Maj-Ctrl-F7 : switch between opened views
  • Ctrl-F8 and Maj-Ctrl-F8 : switch between perspectives
  • Alt-Shift Q Q : open a closed view

And press ESC to get back to editing.

Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on LinkedIn

2 comments

  1. “Java has a bad reputation when it comes the tool chain”

    No it most certainly does not. Java toolchains are amongst the most advanced and powerful in existence. Even Eclipse, which can be clunky and even slow at times, is much more advanced than Microsoft’s equivalent. Eclipse may look ugly on Linux, but the alternatives for other languages are uglier and buggier.

    You have clearly never used IntelliJ, or you would realise that is not far from perfect, but very close to perfect. No other IDE on earth comes close. Of course you need to learn to use your tool, but once you have learned to use Intellij, you will never look back.

    1. I’m using intellij when I get the choice, and I too, prefer it to eclipse. I don’t think it’s possible to declare one IDE to be absolutely “the best ever”, as people value different things. Also, i talked about reputation, not the actual truth behind it.

      Anyhow, that wasn’t the subject of the article – you don’t always get to pick in the sad world of the enterprise :)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>