Cannot load 32-bit SWT libraries on 64-bit JVM

天涯浪子 提交于 2019-12-13 04:30:10

问题


My computer is win7 64 bit, and jdk is 1.7.0.21,jvm is 1.6.. and 64 bit I want to run SWT application and export as runnable jar file. When I run the application, it has the exception that Cannot load 32-bit SWT libraries on 64-bit JVM, so I import the SDK as alternate jre just like you point at Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file ), and in Eclipse, the application can run correctly, but when I edit the bat file to run the jar file, it always has the problem like Cannot load 32-bit SWT libraries on 64-bit JVM, I have the swt.jar for 64 bit, but I don't konw how to replace and I wanna edit the bat file with the information with the SDK. How to handle the problem?


回答1:


You have a 64bit JVM so it won't run the 32-bit SWT libraries. You need to either:

  1. Download and install the 32bit JVM and change your project's settings to run the 32bit JVM instead of the 64bit one.
  2. Download and install the 64bit libraries instead.

This previous SO question has a great description of the first option with accompanying diagrams:

Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )




回答2:


64-bit JVM ? you should use the 64-bit swt




回答3:


Apart from the appropriate swt lib corresponding to the Operating system and their bitness, sometimes consider the following also:

My environment:

32 bit Ubuntu

32 bit JVM/JRE

Eclipse running using the 32 bit JRE

32 bit Gtk SWT

Approach 1: I faced the problem when I was replacing the 32 bit swt with 64 bit swt to test on other platforms. To resolve, I had to remove/clean the project and rebuild the project with the 64 bit swt. But this step logically does not make sense, still works.

Approach 2: All my swt libs for each O/S had the same name- "swt.jar" residing in different folders. I only changed to the appropriate lib when testing, i.e., 32 and 64 bit o/s both has swt.jar. Now this was somehow causing some problem. Not yet able to identify. But on changing the name to something different for each of the swt lib files, it got resolved. This step also does not make much sense.

Approach 3: I am working using geotools api version 10.5 which also contains an swt library in the bin folder. I had to remove it from the folder (move to alternate location) and now my app runs smooth!!




回答4:


I had a similar issue. Installing 32-bit jvm on my 64-bit machine solved the issue.




回答5:


My dificult to work with SWT is the distribution. It's require a installation for each SO (Linux, Windows | 32, 64), Swing no have this problem and is cool, but I prefer SWT/JFace.

To solve this problem I create a Ant script to zip each installation with its rightful swt jar.

I get the specific swt jars in:

http://archive.eclipse.org/eclipse/downloads/drops/R-3.6.1-201009090800/index.php#SWT



来源:https://stackoverflow.com/questions/18190414/cannot-load-32-bit-swt-libraries-on-64-bit-jvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!