Saturday, October 27, 2007

Eclipse on Leopard: fine. 64-bit? Not so fine.

I know I'm a late adopter and all, but I thought I'd provide some information on Eclipse on OS X Leopard. First off: it runs fine. Many of the concerns were that 64-bit Java would break Eclipse because of the SWT/Carbon underpinnings, which are 32-bit, as I understand it.

Well, rest easy - as it does with many new technologies, Apple has left full backwards compatibility in place. It appears that Java runs in 32-bit mode by default, so basically everything that worked previously (including SWT) will continue to work.

So what about Eclipse on 64-bit Java? Yeah, it doesn't work. So - to all those that predicted this, kudos. You got it right. Adding "-d64" is the flag that tells the JVM to run in 64-bit mode - and adding this to eclipse.ini "-vmargs" causes an exception when SWT is loaded.

Want to test if you can run 64-bit Java? Here's what to do. In Terminal, run the following command:



/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java -d64 -Xmx2560M -version

Running this should output something like so:



java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_13-119, mixed mode)

If you don't get this, or get some type of message like "Cannot run Java in 64 bit mode. Continuing in 32 bit mode." then you may not have a 64-bit chipset. Notably, the PPC chips (while G5s are 64-bit) cannot run 64-bit Java). Further, the first generation of Intel chips released by Apple, Duo Core, are not 64-bit. Only the Core 2 Duo (and later) chips are 64-bit. Finally - if you ran the "-d64" test by just specifying "java" on the command line, instead of the full path - you may be running into a bug that was discovered too late to be fixed in GM.

I'll give a shot at running 64-bit Java from within Eclipse (say, to run JBoss AS - that should work). I'll report back with results!

14 comments:

Sean Scott said...
This comment has been removed by the author.
P said...

I've noticed that I couldn't hit the 'return' key in Eclipse anymore when going through a drop-down or contextual menu...

Brice said...

@patrick

Hmmm, I don't use that keyboard functionality much. But just testing it verified what you wrote (on 3.2.x, not running 3.3 yet). However, when I tried with hitting spacebar, that appeared to work fine.

Cheers,
Brice

Sean Scott said...

Ok, I will comment on my original comment, which I deleted.

Basically, I found that Eclipse crashed frequently on leopard. Seems almost any popup dialog did it. I erased the post because although I could reproduce repeatably, after I posted it didnt happen "everytime".

Anyway, this issue has a bug associated with it, and a developer has committed a fix. I am not sure when the fix will be in an eclipse release though.

Here is the bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=207827

John Rizzo said...

I've had so many problems running eclipse on leopard that I'm holding off on upgrading until I can make sure it won't be a problem. In general things appear to work but you'll get errors about not being able to load classes, not being able to access the clipboard, etc.

I'm going to wait until others have worked through these issues.

Brice said...

For folks that are having issues: are you seeing issues in 3.3+ or in 3.2.x? (or both?).

I haven't been heavily using Eclipse in the past few nights, as I've been working on a non-Java project (well, non-any language, really - proprietary templating language from a vendor).

But, my basic testing so far hasn't yielded any instability, at least on 3.2.x.

It would be odd (I think) that we would see this many problems, when Java hasn't *really* been updated. Yeah, there's a 64-bit VM now, but it isn't running by default. Without that, basically its just an updated to JDK update 13, right?

Has anyone seen any rhyme or reason to why there should be this many problems suddenly in leopard? I could see some issues if we're all of a sudden on a new major version (like 6).

Attila Szegedi said...

Yep, there are keyboard issues. I.e. if I press Command+Shift+U ("Occurrences in File"), it brings up a context menu (to choose among "Identifier", "Implementing Methods", and "Throwing Exceptions"). However, both the menu *and* editor window receive the keyboard events for arrows, and when I hit Return, the context menu disappears altogether (without performing the selected operation), and the key is interpreted by the editor (i.e. inserts a new line...)

Brice said...

@attila

Yep, I'm seeing this, too. Very odd. This is on 3.2.x - what version are you on?

P said...

I'm seeing the same key event problem on 3.3.0

Jimothy said...

The menu/key problem appears to be fixed in the latest milestone (3.4M3). Unfortunately, this means I'm missing the features from the Web Tools Project, but I think not being about to type menu selections drives me more crazy.

Liviu Voicu said...

If you don't get this:
Last login: Sun Jan 27 13:15:10 on ttys000
bobdenaut:~ voiculiviu$ java -d64 -Xmx2560M -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_13-119, mixed mode)
bobdenaut:~ voiculiviu$

Then, you have to configure your system to run java in full path with an alias in your .bash_profile:

alias java="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java"

N. Peeters said...

I have actually (unfortunately) upgraded to Java 1.6.0 (on Leopard) and can't run Eclipse (Ganymede). I suspect that this is because of the 64-bit incompatibility, right?

However, for some strange reason, I can't find in the list of installed Java version the old 1.5.0... Is there anyway to reinstall that? Please help.

pedro velasquez said...

The above statement from Apple engineerdominical costa rica tours seems to confirm that it is not possible to mix 64-bit and 32-bit calls within the same process.
What does this mean for SWT on Leopard? Does it mean SWT applications will not run at all under the 64-bit Leopard JVM? Or that they will have to be "demoted" to 32-bit mode somehow?
http://www.dominicalcostaricatours.com

Anonymous said...

I was interested know about it.
sex bondage videos