Saturday, 13 October 2007

First Impressions of Eclipse

Our move into the Scala market must begin with a survey of the existing tools used by Java programmers that Scala programmers can exploit. Eclipse is unquestionably one of the most highly ranked tools among Java programmers, so our journey starts there. This is a beast of an integrated development environment (IDE) that IBM allegedly spent $40M creating.

Under a Unix environment with apt (such as Debian, Ubuntu or Mac OS X), Eclipse and all of its dependencies may be installed from the command line with:

$ sudo apt-get install eclipse

However, the resulting install on our Debian Linux box was extremely unstable, with Eclipse often dying from null pointer exceptions. After much Googling, it transpires that the cause is that Eclipse is being executed in the default Java installation of this system which is GNU Java rather than Sun's JVM.

For Eclipse to run reliably, you must change the default Java to Sun's Java. The official solution is to run the following:

$ sudo update-alternatives --config java

and select Sun's Java. Now you have a working Eclipse installation under Unix.

We are also developing under Windows. On this platform, you download the Windows version of Eclipse, unpack the archive and run the eclipse.exe file that was inside it. There does not appear to be a Windows installer.

Eclipse has a 30 second startup time on these machines (dual core 2.2GHz 64-bit machines), after which you see an introductory page offering "Overview", "What's new", "Workbench", "Samples" and "Tutorials".

Installing Scala and its Eclipse plugin under Debian Linux is easy using apt and the software update feature of Eclipse. Under Windows, the software update feature fails due to dependencies.

As a brief test of Eclipse, we tried to write a few simple programs:

  1. Command-line "Hello World".
  2. GUI "Hello World".
  3. Minimal OpenGL program using JOGL.

The Java programming language is infamously verbose and it is interesting to note that the boiler-plate code required by the Java language is augmented by a lot of "boiler plate" mouse clicking with Eclipse.

Getting a command-line "Hello World" program working is quite easy, although much more laborious than using the command line. Finding a GUI "Hello World" program is harder that expected. The HelloWorldSWT program given in Eclipse's own tutorials requires libraries to be manually downloaded and installed. In fact, Googling turned up several Swing-based "Hello World" programs and, although many of them are no longer valid due to library and namespace changes, the following program currently works:

import javax.swing.JFrame;
import javax.swing.JLabel;

public class HelloWorld {
* @param args
public static void main(String[] args) {
JFrame frame = new JFrame("HelloWorldSwing");
final JLabel label = new JLabel("Hello World");


At the time of writing, we have been unable to build any OpenGL programs in Eclipse. So the first impressions of Eclipse are that it is cumbersome to install and use, both under Linux and under Windows. This is a surprising result given that an IDE is intended to simplify development but shall focus on using command-line tools in future simply because they are at least as easy to use.


Robert said...

The first time I logged into Emacs, I couldn't do anything and had to shut down the whole computer to log out. My introduction to VI wasn't much kinder ("What mode am I in again?")

Eclipse is an IDE: it's much heavier than any command-line tools, so it's only to be expected that to use it well is going to take at least as much time/effort as the command-line tools. However, it also has a lot of functionality that command-line tools don't provide (see it's refactoring support, outlining tools, and plug-ins for support of things like Spring, Hibernate, SVN, etc., etc.).

Of course you're going to be blown out of the water the first time you fire it up. If Emacs and vi blow people out of the water, would you really expect Eclipse to be better?

And the whole NPE thing isn't Eclipse's fault -- it's the fault of the Java community, which has taken the Sun JDK series as being the One True Implementation. If you deviate from there, it's at your own peril.

Jon Harrop said...

I agree completely that Emacs and co are very difficult to get a handle on.

However, I expected Eclipse to have a lower activation barrier for newbies because it has a GUI. I mean, weren't GUIs invented to make life easier?

Also, I did not suffer from the same heartache when I started using Visual Studio and coding in .NET languages. Getting equivalent introductory programs compiled and running in C# and Visual Studio is much easier than in Eclipse. So the fact that Eclipse is an IDE does not excuse it because other IDEs do not suffer the same fate.

Finally, given the JVM's legacy as the foremost web programming platform I was expecting a lot more web integration. Instead I found its package managing to be worse than that of the "apt" package manager used in Debian, Ubuntu, Mac OS X and so forth.