java.lang.UnsatisfiedLinkError:无法在 Windows x86 机器的 32 位 JVM 上加载 64 位 SWT 库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4415827/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 17:14:08  来源:igfitidea点击:

java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM in Windows x86 machine

javaeclipseswtwindows-vistaunsatisfiedlinkerror

提问by santhan

I've just started using swt (windows x86_x64 compatible version). When I run a sample code snippet in Eclipse, I am getting the following error...

我刚刚开始使用 swt(windows x86_x64 兼容版本)。当我在 Eclipse 中运行示例代码片段时,出现以下错误...

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM
 at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
 at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
 at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
 at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
 at Snippets.main

I have Windows Vista on my machine. I believe this swt version should support both 32 bit and 64 bit Os. What am I missing to get things work for 32 bit?

我的机器上装有 Windows Vista。我相信这个 swt 版本应该同时支持 32 位和 64 位操作系统。我缺少什么才能让 32 位的东西正常工作?

If in case I've a wrong version of JVM, how do I change it?

如果我的 JVM 版本错误,我该如何更改它?

回答by Martin v. L?wis

The x86_64 version will definitely not work in a 32-bit process. You need to get a 32-bit version of SWT.

x86_64 版本肯定不会在 32 位进程中工作。您需要获得 32 位版本的 SWT。

回答by TheCric

A solution is given for the 32 bit installation of SWT on Eclipse here http://www.badprog.com/eclipse-standard-widget-toolkit-swt-installation

此处为 Eclipse 上的 SWT 32 位安装提供了解决方案 http://www.badprog.com/eclipse-standard-widget-toolkit-swt-installation

回答by John Doe

This happens if you try to run a 64bit library against a 32bit JRE. 32bit can run on 64bit but not vice versa.

如果您尝试针对 32 位 JRE 运行 64 位库,就会发生这种情况。32 位可以在 64 位上运行,但反之则不行。

If you have a 64bit JVM installed, you can modify settings in the menu Run > Run Configuration then select the correct JRE.

如果您安装了 64 位 JVM,您可以在菜单 Run > Run Configuration 中修改设置,然后选择正确的 JRE。

Otherwise just get the 32bit version of the SWT.

否则,只需获取 32 位版本的 SWT。

回答by sma

One special case is that if you only see it when you try to open Android sdk manager, which indicates that the sdk tools cannot locate your java.exe properly. Go to your sdk folder, open tools/android.batfile, find the line says "set java_exe", change it to "set java_exe=ABSOLUTE_PATH_TO_YOUR_JAVA_EXE" and comment out the two following lines;

一种特殊情况是,如果你只在你尝试打开Android sdk manager时看到它,这表明sdk工具无法正确定位你的java.exe。进入你的sdk文件夹,打开tools/android.bat文件,找到“set java_exe”这一行,改成“set java_exe=ABSOLUTE_PATH_TO_YOUR_JAVA_EXE”,注释掉下面两行;

回答by Shambhavi Bhat

My eclipse was not starting. I checked the logs in workspace/.metadata/.log. java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM exception was present. This was caused because my machine, eclipse, java configuration was like this Machine: Windows : 64 bit Eclipse : 64 bit Java : 32 bit

我的日食没有开始。我检查了工作区/.metadata/.log 中的日志。java.lang.UnsatisfiedLinkError:无法在 32 位 JVM 上加载 64 位 SWT 库异常存在。这是因为我的机器,eclipse,java 配置是这样的 机器:Windows:64 位 Eclipse:64 位 Java:32 位

I corrected JAVA_HOME& Path. Did not seem to work. Solution : I added -vm with correct jvm path in eclipse.inifile. It worked for me. I was able to start eclipse. Example : I pointed to 64bit jvm to start 64bit eclipse

我更正了JAVA_HOME& Path。似乎没有工作。解决方案:我在eclipse.ini文件中添加了 -vm 和正确的 jvm 路径。它对我有用。我能够开始日食。示例:我指向 64bit jvm 启动 64bit eclipse

-vm C:\Program Files\Java\jdk1.7.0_75\bin\javaw.exe