views:

1919

answers:

2

I have recently discovered the incredibly useful Eclipse Memory Analysis Tool, which makes quick work of finding memory leaks in Java applications. Unfortunately, after switching my JDK to 1.6 (under Mac OS 10.5), the JVM terminates immediately upon startup. All that appears is a dialog stating "JVM terminated" with "Exit code = -1".

Anyone else encounter this one? Perhaps there is a way to configure it to use a different JDK? (such as 1.5: which it was shown to be compatible with)

+1  A: 

The official Java 6 for the Mac only has a 64 bit data model. Unfortunately, Eclipse uses Carbon on the Mac which is only available in 32 bits. In short, it is impossible to run Eclipse with the official Java 6 distribution.

The classical solution to this is to set the default VM to Java 5, and then choose Java 6 as the JRE/JDK within Eclipse.

If you really need to run Eclipse with Java 6, then you could take a look at SoyLatte which is a build of OpenJDK which both supports 32 and 64 bit modes.

Guðmundur Bjarni
This is what i had to do too
Paul Whelan
+3  A: 

To configure Eclipse to use another VM use this command line:

eclipse -vm <path to java>

You can also specify the path in Eclipse.app/Contents/Info.plist. There is a section like this:

<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options:
    <string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java</string>
    <string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java</string>
-->

For the Memory Analyzer the you can find the Info.plist file under MemoryAnalyzer.app/Contents.

Turismo
I should point out that this isn't eclipse I am running but an application based on the Eclipse platform. That being said I'll have to see if I can pass the path to java as a command line argument to the app.
Ryan Delucchi
There should be a similar folder for the MemoryAnalyzer as it is based on Eclipse.
Turismo
Aha! That did it! Thanks a lot!
Ryan Delucchi