Using a Java 6 based Eclipse with Cocoa

This is somewhat niche, but I’m going to post it anyway in case it helps somebody else

I recently saw a problem with Eclipse and m2eclipse. When I tried to import a Java 6 based project, I got an error in the maven console.

Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6
Usage: javac  
where possible options include:
 -g                         Generate all debugging info
 -g:none                    Generate no debugging info
 -g:{lines,vars,source}     Generate only some debugging info
 -nowarn                    Generate no warnings
 -verbose                   Output messages about what the compiler is doing

This is happening because m2eclipse is trying to run the compiler from within the same JVM that Eclipse is running. And by the downloads only offer Carbon and Cocoa options. Both of these are 32 bit. Which means they’ll only ever run using Java 5, even if you’ve got Java 6 installed (unlike my iMac G5, grumble, grumble).

Thankfully, the 64 cocoa version is available, though it’s only the old “Eclipse SDK” download. But ekke wrote up [galileo] EPP for Cocoa 64-bit, which shows how to go about getting (effectively) the same setup as the downloads.

If you follow along that procedure, you get an eclipse that works well with m2eclipse and Java 6 project. As a bonus, it feels quicker to me.

Hopefully future versions of Eclipse will offer a 64-bit cocoa download.

Comments 3

  1. Ken Liu wrote:

    Thanks for this post! I spent a whole evening trying to get m2eclipse working with Apple’s Java 6 before I came across this. I don’t think I noticed any speed difference, though.

    Posted 12 Aug 2009 at 04:34
  2. Brian wrote:

    Thank you! been chasing this all day on my snow-leopard installation. Now I know what my issue is I can try to fix it!

    Posted 23 Oct 2009 at 18:32
  3. dom wrote:

    Actually, since I wrote this, eclipse 3.5 SR1 has been released. There is now a 64-bit cocoa download available from the regular eclipse download page.

    Posted 24 Oct 2009 at 08:15