无法在32位JVM上加载64位SWT库(替换SWT文件)

Mad-D:

我正在尝试调试此问题,但不确定在哪里确切需要替换 Eclipse的SWT jar文件。

当前系统配置:

Eclipse Helios 3.6 - 32 Bit
JDK 1.6 
JVM - 32 Bit 
Windows 7 - 64 Bit

错误信息:

java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:174)
    at org.eclipse.swt.internal.C.<clinit>(C.java:21)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:138)
    at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:687)
    at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
    at de.vogella.rcp.intro.first.Application.start(Application.java:18)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
An error has occurred. See the log file

解决方法:

  1. Link1:理解了问题的原因,我尝试将64位SWT替换为32位,但是我不确定我是否做对了?

    下载的32位文件swt-3.6.1-win32-win32-x86.zip提取zip文件具有如下所示的文件

    在此处输入图片说明

    复制的swt.jar文件导航到C:\ Program Files \ eclipse \ plugins删除64位Swt文件(即org.eclipse.swt.win32.win32.x86_64.source_3.6.2.v3659c),放置复制的swt.jar文件并重新启动

    仍然抛出相同错误

    还尝试将swt.jar文件重命名为org.eclipse.swt.win32.win32.x86_64.source_3.6.2.v3659c

    还是一样的错误

  2. Link2:建议了替代解决方案,但无法解决问题。

    还是一样的错误

  3. 我真的不想卸载32-JVM和32位Eclipse并安装相应的64位版本。

    不是选项

解决方法在paulsm4Paul Webster回应之后,我感到困惑

当我尝试执行此命令以检查JVM,Eclipse中的JRE版本时

package javaVersion;

public class JavaVersion
{

    public static void main( String[] args )
    {
        System.out.println( "JRE Version :" + System.getProperty( "java.runtime.version" ) );
        System.out.println( "JVM Bit size: " + System.getProperty( "sun.arch.data.model" ) );

    }

}

输出:

1.6.0_31-b05
JVM Bit size: 32

但是,当我在命令行中尝试使用JAVA-版本

在此处输入图片说明

因此,我的理解系统具有64位JVM,而Eclispe正在读取32位JVM。那么,如何转移系统以读取32位JVM?

爱德华·汤姆森:

Eclipse将使用您在启动配置中定义的任何JRE启动您的应用程序。由于您正在运行32位Eclipse,因此要针对其32位SWT库运行/调试,并且需要运行32位JRE。

无论出于何种原因,您的64位JRE都是默认的Installed JRE。

要更改此设置,请首先确保在Installed JREs首选项中配置了32位JRE。转到窗口->首选项,然后导航至Java->已安装的JRE:

已安装的JRE

您可以单击添加,然后导航到32位JVM JAVA_HOME进行添加。

然后在“运行配置”中,找到您的Eclipse应用程序,并确保将“运行时JRE”设置为您刚刚配置的32位JRE:

运行配置

(请注意组合框突出显示效果很差。)

不要尝试更换SWT广口瓶,否则可能效果不佳。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章