eclipse juno (4.2) review

After my little adventure with Java 7, downloading Eclipse and configuring it was a non-event.

Downloading

The download site is smart enough to pick up on the fact that I am on a Mac and default to presenting me with choices of packages/bits for my OS.  I have to choose between Eclipse for JEE developers and Eclipse for Java developers.  The former has web tools and JEE tools.  The later has eGit and Maven.  It sounds easier to install eGit and Maven after so I chose the JEE edition.  It’s a 200MB download so I need to allow half an hour for download.  Time to do something else for a while.

Plugins

My plugin list is similar to what I installed for Eclipse 3.7 (Indigo).  In fact this year, I didn’t install them one at a time. I used the suggestion in last year’s blog comments and did:

  1. import > install > from existing installation
  2. Pointed to old eclipse
  3. Eclipse then gave me a list of what plugins I had installed and asked which I wanted.
  4. Accepted all the licenses and everything got downloaded/installed together.

Very cool! [last year I couldn’t do this because my Eclipse 3.6 was on a different computer]

The significant plugins I use: (I’ve installed a couple others over the past year and migrated those, but I’m not that attached to them.)

Plugin Purpose
Sysdeo Tomcat integration [correction – Sysdeo no longer works in Juno]
Ecl Emma Code coverage
PMD Static analysis
Subversive To access Subversion repositories
Groovy Groovy project/editor and console
m2Eclipse Maven – which I use more to play for downloading jar dependencies than for actually building
Freemarker IDE Freemarker syntax highlighting and macro assistance.

What excites me

  1. Java 7 support in an IDE.
  2. I really like that you can just start typing the method/field name when in quick outline (ctrl/cmd o) and quick hierarchy (ctrl/cmd t) pop-ups.
  3. Detecting resource leaks of Closeable/Autocloseable resources.  This is awesome because it helps with “old code” too. The common IO/JDBC resources now implement the relevant interfaces.  And the warning is smart enough to pick up on these!
  4. The global search bar gives you quick access to almost any Eclipse feature.  So if I type in “SVN”, I can go right to the SVN repositories view.
  5. When you drag a pane from one part of the IDE to the other, there is a green trim showing where it will wind up.

What frustrates me

  1. Detached editors (open in a new window) look really cool, but they feel awkward to use.  The way to open in detached mod is to drag outside the workbench.  Since I’m usually in full screen mode, this means drag to the OS icons at bottom.  Which is fine – I can get used to that.  The help says you can also get it by clicking “detached” in the menu you get when right clicking the part’s tab.  I don’t get anything by right clicking other than the option to close.
  2. This isn’t new, but HTML formatting is still not what I’d expect. Multiple HTML tags format on the same line and then split before the first attribute.  This isn’t new and it isn’t any worse than previous versions of Eclipse.  Which means I’ve gotten used to it on some level.

What I’m neutral on

  1. Very bright/white windowing – it’s fine, but going to take some getting used to.
  2. Code Recommenders – Intelligent code completion.  I think I’m only neutral because I haven’t gotten to try.  The concept looks really cool

java 7 does not work with eclipse 3.6 or open office

In preparation for downloading Eclipse 4.2 (Juno), I downloaded Java 7 for the Mac.  It was quite an experience.

TL/DR: Don’t use Java 7 with Eclipse 3.6 or Open Office 3.  Alternatives below.

Installed Java 7 for the Mac

Up to now, I’ve been doing all my Java 7 learning/testing/etc in a Linux JVM.  Now that Juno is out, it seemed high time to add it to my path.

  1. Download the dmg from jdk7.java.net or Oracle’s main site. (both are now Oracle versions.  The former is a slightly later version since it is a release preview.  Oddly enough installing the Oracle one uninstalled the newer preview version of the jdk7 one.
  2. Click on dmg.  Double click to get Java wizard
  3. Open finder.  In the go menu choose utilities
  4. Choose java preferences and uncheck Java 1.6 or previous versions of 1.7 you have downloaded.
  5. Now “java -version” at the command line is Java 7.

Dr Dobbs describes this well with screenshots although they do assume you know how to open the java preferences.

Eclipse problem

Error: “failed to create the Java virtual machine”

However, when I tried to launch Eclipse 3.6, I got “failed to create the Java virtual machine.”

The first thing I did was check my path still contained the JDK:

javac -version
javac 1.7.0_05

I then tried the Eclipse alias that runs at a command line which got more of an error message:

/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse ; exit;
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
logout

This problem is discussed in a stackoverflow thread. Juno does fix this problem.

Summary: Stay on Java 6 with Eclipse 3.7 (Indigo) and go to Java 7 with Eclipse 4.2 (Juno).

 Open Office problem
Error: OpenOffice.org requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools – Options – OpenOffice.org – Java.
Oh fun.  OpenOffice doesn’t yet play well with Java 7.  I wound up switching my system JRE back to 6 and my default Eclipse JRE to Java 7.  This makes everyone happy.

svn, global search/replace and recovery

I started with a nice simple problem: do a global search and replace on the image directory path to save bandwidth (by pointing to a caching server.)  I used this regular expression and then had two problems:

  1. This isn’t easy to read (which isn’t a huge deal since I only have to run it once.)
  2. The find and replace updated the hidden .svn directory too.  Which meant when I went to sync with SVN, it thought it was up to date and didn’t commit anything.
More on both these problems.
Problem 1 – Unreadable regexp

find $path/templates/default -type f | xargs perl -pi -e ‘s/\$\{contextPath\}\/templates\/default\/images/\$\{imagesServedFrom\}\/templates\/default\/images/g’

All right.  What does this do?
  1. Find all files in the templates/default directory or any subdirectories
  2. Do a search for ${contextPath}/templates/default/images and replace with ${imagesServedFrom}/templates/default/images
I’m sure there is a clearer way of writing this.  I didn’t bother once I had something working because I only have to run it once.  (Famous last words, I know.)
Problem 2 – Updating SVN

The bigger problem is that I made a bunch of other changes in my commit and didn’t notice that none of the template/default/image changes got committed.  Eclipse/SVN didn’t commit the changed files because the .svn directory’s base file was changed as well.

I solved this by disconnecting from SVN in Eclipse. (Team disconnect) and deleting the metadata when prompted.  I then reconnected to SVN, Eclipse saw the difference and I committed normally.

If I was doing this again, I’d update the find statement to exclude the .svn directories.