Friday, June 02, 2006

Running Eclipse: Windows or Linux?

Well, I chose Linux, the Ubuntu Breezy edition. There's a Windows version, but I think Eclipse is better suited to the Linux environment, but I admit that's a personal opinion. In fact, I'm writing this with Open Office running under Ubuntu.

Installing Eclipse

There's an Eclipse that comes with Ubuntu. Well, I think you actually use gnome-apt-install. It's an icon on the top menu bar. I don't remember whether it's there by default or I put it there. You got to be root to run it. I was not happy with this Eclipse. It appeared to be missing source code, and one of the points of having Eclipse is to look at the source code, not to modify it, but to understand what's going on. I'm going to be interested in adding plugins, and books tell me I should look at source code when I do that.

I downloaded eclipse-SDK-3.1.2-linux-gtk.tar.gz from www.eclipse.org, placed in my directory /home/ted/Eclipse_downloads, unzipped with gunzip, then untarred with tar vxf. There isn't really any configuration. Untarring releases a bunch of files from the tarball, one of which is an executable called eclipse.

Where's the best place to install Eclipse? I don't know.

I run that executable without arguments. I'll add args later, but for now this is it.

Now there's a question of what java I'm using. Inside Eclipse. I can look at Windows-Preferences... and then on the right panel open up java and select Installed JREs. I chose the Sun JDK, which I donwloaded from Sun a while back. I'm not sure what the other JVMs are. One came with Ubuntu, and it doesn't work well with Eclipse. If I use the original java, I can make java programs OK but cannot stop at a breakpoint. I talked with Bill at Padnug about this, and he says this is a known problem, but it's not clear whether it is a java or an eclipse issue. Let's see if I understood this correctly. The JVM signifies when it reaches a breakpoint and some JVMs do it differently than others. Eclipse does not recognize all the variations.

One of my books (I got a bunch on Eclipse that I read all at once; this one is eclipse Distilled by David Carlson) says that “you might have several version of java installed on your computer and you should use the -vm option to specify the one you want to use.” Well, I don't. But the Eclipse IDE itself is telling me what java I'm using.

 

Notice the line on top of the console window. It says /usr/lib/j2sdk1.5-sun/bin/java, the Sun version I installed.

Also, my command window shows java goes there.

ted@halibut:~$ which java

/usr/bin/java

ted@halibut:~$ ls -l /usr/bin/java

lrwxrwxrwx  1 root root 22 2005-12-26 15:32 /usr/bin/java -> /etc/alternatives/java

ted@halibut:~$ ls -l /etc/alternatives/java

lrwxrwxrwx  1 root root 30 2005-12-29 13:46 /etc/alternatives/java -> /usr/lib/j2sdk1.5-sun/bin/java

 

The same links work for javac.

Looking at the Eclipse Source Code

So this is how I did it. I'm reading Contributing to eclipse by Erich Gamma and Kent Beck. This is an excellent book, written by two famous programmers, but it is somewhat out-of-date. Its examples come from an older version of Eclipse, and the screens show windows that we don't have any more.

So this is what I did. Choose File – Import ... Then, select External Plug-ins and Fragments and click Next. Choose to import as Binary projects, which makes the projects read-only. You can still look at the source for binary projects, and you want to look at that source when you add a plug-in of your own. But you don't want to modify any of that source. Click Next again and select Add All ...

The in the Package Explorer, you see a lot of projects. You can use the dropdown menu in the Package Explorer to filter out these plugins and see only your own projects if you want to. But if you leave then there and navigate to a class in one of the plugins, this is what you see. Yes, you can cruise the source code, which is just what I want to do.

 

This is org.eclipse.debug.core. Then open up org.eclispe.debug.core_3.1.2.jar. Then under org.eclipse.debug.core, double-click DebugPlugin.class. The book says to use Navigate – Open Type and put in *, but I haven't had luck with that. The resulting window always shows OK as disabled.

 

6/2/2006 1:13:44 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback