简体   繁体   English

如何在MacOS 10.5.6上运行Eclipse 3.4.1?

[英]How to run Eclipse 3.4.1 on MacOS 10.5.6?

I am trying to run Eclipse 3.4.1 on MacOS 10.5.6? 我想在MacOS 10.5.6上运行Eclipse 3.4.1吗? I think I am using java 1.5 when I run eclipse: 我想我在运行eclipse时正在使用Java 1.5:

$ which java /usr/bin/java $ java -version java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing) $其中java / usr / bin / java $ java -version java版本“ 1.5.0_16” Java(TM)2 Runtime Environment,标准版(内部版本1.5.0_16-b06-284)Java HotSpot(TM)客户端VM(内部版本1.5 .0_16-133,混合模式,共享)

And then I click eclipse icon. 然后,我单击Eclipse图标。

In the Preferences->Java->Installed JREs, I did click 'JVM 1.6.0', since I needs to use 1.6 for my project. 在Preferences-> Java-> Installed JRE中,我确实单击了'JVM 1.6.0',因为我需要在项目中使用1.6。

But in the .log file, I am getting these errors, why there is class file bad version number? 但是在.log文件中,我遇到这些错误,为什么类文件的版本号错误? And how can I fix it? 我该如何解决?




!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)

Eclipse on Mac OS X on Intels only works with JDK 5 (it's horrible). Intel的Mac OS X上的Eclipse仅与JDK 5兼容(这太可怕了)。 I always have to create two versions of my plugins. 我总是必须创建两个版本的插件。

However, it seems that the Android editor plugin that you're using was compiled against 1.6, so I'm not sure that there's a solution... 但是,您正在使用的Android编辑器插件似乎是针对1.6编译的,因此我不确定是否有解决方案...

Take a look at this line: 看一下这一行:

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

That error means that you're attempting to execute bytecode in a JRE that is older than the JDK you used to compile. 该错误意味着您正在尝试在比用于编译的JDK还要旧的JRE中执行字节码。 In your case, the version 5 JRE doesn't recognise the file magic added by the v6 JDK and quits before it hits bytecode it can't understand. 在您的情况下,版本5 JRE无法识别v6 JDK添加的文件魔术,并在遇到无法理解的字节码之前退出。

The solution to this is to either specify a target version for the compiler, or upgrade your JRE. 解决方案是为编译器指定目标版本,或升级JRE。

You will need to install java 6 on to your Mac if you want to 1.6 in your project. 如果要在项目中安装1.6,则需要在Mac上安装Java 6。 You should be able to get java 6 here: 您应该可以在这里获取Java 6:

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

I was able to get Eclipse 3.5M5 to run with JDK 1.6.0 as its base VM with a slightly modified path from above: 我能够使Eclipse 3.5M5与JDK 1.6.0作为其基本VM一起运行,并从上面进行了稍微修改:

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

Better, I was able to put it in the eclipse.ini file in /Applications/eclipse3.5/Eclipse.app/Contents/MacOS, so long as it went above the '-vmargs'. 更好的是,我能够将其放在/Applications/eclipse3.5/Eclipse.app/Contents/MacOS的eclipse.ini文件中,只要它位于“ -vmargs”之上即可。 For example: 例如:

-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
...

You can try the latest Galileo (Eclipse 3.5) milestone. 您可以尝试最新的Galileo(Eclipse 3.5)里程碑。 It is not very stable, but it will run on Apple's JDK 1.6. 它不是很稳定,但是可以在Apple的JDK 1.6上运行。 Get it here (3.5M4 is the latest). 在此处获取(最新版本为3.5M4)。 Make sure you get the cocoa 64 bit version. 确保您获得了可可64位版本。

Start it with -vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java 使用-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java启动它

Again, an early beta with all implications. 再次,具有所有含义的早期测试版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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