SWT: UnsatisfiedLinkError, cannot load x64 SWT library on 32-bit JVM
At first when developing my program I got this error the other way around; it told me I couldn't use a 32-bit SWT library on a 64-bit JVM. So I went and got the 64-bit library and used that. Now when I run my program on a different computer, which has a 32-bit 开发者_如何学PythonOS, it gives the error. Is there no way to make SWT run regardless of if you have 32 or 64 bit OS?
You have to include both versions in your product, so that the correct one is available no matter what the architecture. You can also include Linux and Mac versions, to make your product truly portable.
The build paths are different for each set of SWT libraries so you have to make separate versions for each operating system that you want your application to run on. To do this, configure the build path so that only the JRE and platform-specific libraries are included, then make a runnable jar (Eclipse is excellent for this). It's tedious and goes against the Java paradigm, but its the only way (that I know of).
精彩评论