简体   繁体   中英

JVM terminates when launching Eclipse MAT on Mac OS with J2SE 6.0

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)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM