如何在MacOS 10.5.6上运行Eclipse 3.4.1?

时间:2009-01-29 18:13:47

标签: java eclipse macos

我想在MacOS 10.5.6上运行Eclipse 3.4.1? 我想当我运行eclipse时我正在使用java 1.5:

$哪个java 在/ usr / bin中/ JAVA $ java -version java版“1.5.0_16” Java(TM)2运行时环境,标准版(版本1.5.0_16-b06-284) Java HotSpot(TM)客户端VM(版本1.5.0_16-133,混合模式,共享)

然后我点击eclipse图标。

在Preferences-> Java-> Installed JREs中,我点击了'JVM 1.6.0',因为我需要在我的项目中使用1.6。

但是在.log文件中,我收到这些错误,为什么有类文件坏版本号?我该如何解决?




!SESSION 2009-01-29 10:07:29.618 -----------------------------------------------
eclipse.buildId=M20080911-1700
java.version=1.5.0_16
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=carbon, NL=en_US
Framework arguments:  -keyring /Users/samuel/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws carbon -arch x86 -keyring /Users/samuel/
.eclipse_keyring -consoleLog -showlocation

!ENTRY com.android.ide.eclipse.adt 4 0 2009-01-29 10:07:42.947
!MESSAGE Failed to start com.android.ide.eclipse.editors
!STACK 0
org.osgi.framework.BundleException: Exception in com.android.ide.eclipse.editors
.EditorsPlugin.start() of bundle com.android.ide.eclipse.editors.
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:1028)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(Bund
leContextImpl.java:984)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:346)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:265)
        at com.android.ide.eclipse.adt.AdtPlugin$11.run(Unknown Source)
Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class 
file
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:520)
        at com.android.ide.eclipse.editors.resources.manager.ProjectClassLoader.
findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at com.android.ide.eclipse.editors.resources.manager.CompiledResourcesMo
nitor.loadAndParseRClass(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.CompiledResourcesMo
nitor.projectOpenedWithWorkspace(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.ResourceMonitor.add
ProjectListener(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.CompiledResourcesMo
nitor.setupMonitor(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.ResourceManager.set
up(Unknown Source)
        at com.android.ide.eclipse.editors.EditorsPlugin.start(Unknown Source)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(Bund
leContextImpl.java:1009)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:1003)
        ... 4 more
Root exception:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:520)
        at com.android.ide.eclipse.editors.resources.manager.ProjectClassLoader.
findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at com.android.ide.eclipse.editors.resources.manager.CompiledResourcesMo
nitor.loadAndParseRClass(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.CompiledResourcesMo
nitor.projectOpenedWithWorkspace(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.ResourceMonitor.add
ProjectListener(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.CompiledResourcesMo
nitor.setupMonitor(Unknown Source)
        at com.android.ide.eclipse.editors.resources.manager.ResourceManager.set
up(Unknown Source)
        at com.android.ide.eclipse.editors.EditorsPlugin.start(Unknown Source)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(Bund
leContextImpl.java:1009)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:1003)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(Bund
leContextImpl.java:984)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:346)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:265)
        at com.android.ide.eclipse.adt.AdtPlugin$11.run(Unknown Source)


5 个答案:

答案 0 :(得分:2)

英特尔在Mac OS X上的Intels只适用于JDK 5(这太可怕了)。我总是要创建两个版本的插件。

但是,您使用的Android编辑器插件似乎是针对1.6进行编译的,所以我不确定是否有解决方案......

答案 1 :(得分:1)

看看这一行:

java.lang.UnsupportedClassVersionError: Bad version number in .class file

该错误意味着您尝试在比您用于编译的JDK更旧的JRE中执行字节码。在您的情况下,版本5 JRE无法识别v6 JDK添加的文件魔法,并在它遇到无法理解的字节码之前退出。

解决方法是为编译器指定目标版本,或者升级JRE。

答案 2 :(得分:1)

如果您想在项目中使用1.6,则需要在Mac上安装java 6。你应该能够在这里获得java 6:

http://developer.apple.com/java/download/

答案 3 :(得分:1)

我能够让Eclipse 3.5M5以JDK 1.6.0作为基础虚拟机运行,并且从上面略微修改了路径:

  

./ eclipse -vm   /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0

更好的是,我能够将它放在/Applications/eclipse3.5/Eclipse.app/Contents/MacOS中的eclipse.ini文件中,只要它超过'-vmargs'即可。例如:

-startup
../../../plugins/org.eclipse.equinox.launcher_1.0.200.v20090128-1500.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.0.0.v20081125-1800
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0
-showsplash
org.eclipse.platform
-vmargs
...

答案 4 :(得分:0)

您可以尝试最新的Galileo(Eclipse 3.5)里程碑。它不是很稳定,但它将在Apple的JDK 1.6上运行。得到它here(3.5M4是最新的)。确保你获得了64位可可版本。

-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java

开头

同样,这是一个具有所有含义的早期测试版。