SWT在Windows上写dll文件在哪里?

时间:2011-11-16 18:42:49

标签: java windows dll swt

我在互联网上找不到SWT尝试编写dll文件的地方。我有一台计算机,其中jar不能运行只因为SWT无法编写DLL。

更新1

java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at com.sun.javaws.Launcher.executeApplication(Unknown Source)
                at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
                at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
                at com.sun.javaws.Launcher.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
                no swt-win32-3738 in java.library.path
                no swt-win32 in java.library.path
                Can't load library: \\ubz01fst\Students\User2010\Com\xxx\swt-win32-3738.dll
                Can't load library: \\ubz01fst\Students\User2010\Com\xxx\swt-win32.dll

                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 install.Main.main(Main.java:162)

2 个答案:

答案 0 :(得分:6)

我自己找到了答案。 从SWT 3.3开始,您不必再包含本机(DLL)库,因为它们位于jar本身中,并且只要调用SWT库就会解压缩它们。 DLL文件从jar解压缩并放在“System.getProperty(”user.home“)”下的“.swt”文件夹中。 在我的情况下,问题是System.getProperty(“user.home”)设置为“\ ubz01fst \ Students \ User2010 \ Com \ xxx”这是一个UNC路径并且不可写(这通常发生在公司或组织中)电脑)。

我不知道为什么计算机中的System.getProperty(“user.home”)来自Windows的环境变量“HOMESHARE”

解决方案包括使用可写路径更改System.getProperty(“user.home”),例如:

System.setProperty("user.home", System.getenv("USERPROFILE"));

在调用任何SWT代码之前。

答案 1 :(得分:-1)

好的,我找到了解决方案。问题是关于dll的产生。我使用的是3.7m5版本,我下载了以前的版本(3.7)并且应用程序运行正常。

问候。

相关问题