异常如下:
NativeSwing: Exception in thread "main" java.lang.reflect.InvocationTargetException
NativeSwing: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
NativeSwing: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
NativeSwing: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
NativeSwing: at java.lang.reflect.Method.invoke(Unknown Source)
NativeSwing: at chrriis.common.NetworkURLClassLoader.main(NetworkURLClassLoader.java:73)
NativeSwing: Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
NativeSwing: no swt-win32-3655 in java.library.path
NativeSwing: no swt-win32 in java.library.path
NativeSwing: Can't load library: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\swtlib-32\swt-win32-3655.dll
NativeSwing: Can't load library: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\swtlib-32\swt-win32.dll
NativeSwing:
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Library.java:267)
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Library.java:174)
NativeSwing: at org.eclipse.swt.internal.C.<clinit>(C.java:21)
NativeSwing: at org.eclipse.swt.widgets.Display.<clinit>(Display.java:138)
NativeSwing: at java.lang.Class.forName0(Native Method)
NativeSwing: at java.lang.Class.forName(Unknown Source)
NativeSwing: at org.eclipse.swt.graphics.Device.<clinit>(Device.java:85)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:796)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:821)
NativeSwing: ... 5 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at cn.com.xxx.visualization.editor.DPEditor.newInstance(DPEditor.java:811)
at cn.com.xxx.visualization.editor.DPEditor$MyDropTargetListener.drop(DPEditor.java:535)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:456)
at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:258)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:119)
at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:363)
at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:289)
at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:172)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at neu.xxx.Application.start(Application.java:40)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.RuntimeException: java.net.SocketException: Connection reset
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:64)
at chrriis.dj.nativeswing.swtimpl.MessagingInterface.initialize(MessagingInterface.java:47)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:29)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface$SwingOutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:149)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessMessagingInterface(NativeInterface.java:682)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessCommunicationChannel(NativeInterface.java:436)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:187)
at control.Pendubot.PendubotFlashPanel.initialize(PendubotFlashPanel.java:30)
at control.Pendubot.PendubotFlashPanel.<init>(PendubotFlashPanel.java:25)
at control.Pendubot.PendubotFlashControl.<init>(PendubotFlashControl.java:42)
... 44 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:62)
... 53 more
可以看到红色的。这个异常怎么解决呢?
解决办法 分两个方面:
一、在eclipse开发环境下调试时:
http://www.developer.com/java/other/article.php/10936_3330861_2/SWT-Programming-with-Eclipse.htm
摘录如下:
To run the application without using Eclipse, the swt.jar library must be in your classpath, and the java.library.path enviroment variable must be set properly. Depending on the host platform, the appropriate native library file must be available. For the Windows platform, you can do the following to make the native library configuration for your application:
- Put swt.dll in the same directory as the program.
- Put swt.dll in the JAVA_HOME\bin\ directory.
- Put swt.dll in the c:\windows\system32 directory.
javac classpath c:\swt\swt.jar HelloWorld.java
Java classpath c:\swt\swt.jar;. Djava.library.path=c:\swt HelloWorld
The java.library.path is the required environment variable for the JNI. If you don't set this environment, your DLL class is not accessible. In that case, the application cannot run properly and throws an exception.
二、当导出RCP产品时:
有两种办法,本人采用第二种,比较简单。
1、在安装过程中把dll放在java library path下 ,即JAVA_HOME\bin\ directory.
2、导出产品之后,直接把那个dll放在根目录下。
当然也许还有更好的办法,希望拍砖!
分享到:
相关推荐
因为SWT应用了JNI技术,因此同时也要找到相对应的JNI本地化库文件,由于版本和操作平台的不同,本地化库文件的名称会有些差别,比如SWT-WIN32-2116.DLL是Window平台下Eclipse Build 2116的动态库,而在Unix平台相应...
swt&jface&rcp.chm.rar
学习SWT,RCP的笔记.doc
org.eclipse.equinox.p2.examples.rcp.prestartupdate.rarorg.eclipse.equinox.p2.examples.rcp.prestartupdate.rarorg.eclipse.equinox.p2.examples.rcp.prestartupdate.rar org.eclipse.equinox.p2.examples.rcp....
sqlexplorer_rcp-3.6.1.win32.win32.x86.zip
org.eclipse.equinox.p2.examples.rcp.cloud.rarorg.eclipse.equinox.p2.examples.rcp.cloud.rarorg.eclipse.equinox.p2.examples.rcp.cloud.rar
org.eclipse.equinox.p2.examples.rcp.sdkui.rar org.eclipse.equinox.p2.examples.rcp.sdkui.rar v
\org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.rar \org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.rar v
Eclipse-RCP培训教程.rar Eclipse-RCP培训教程.rar Eclipse-RCP培训教程.rar
RCP程序设计基础教程,初学者毕备.RCP程序设计基础教程,初学者毕备.
eclipse插件及RCP开发资料.rar eclipse插件及RCP开发资料.rar eclipse插件及RCP开发资料.rar
rcp org.eclipse.ui.newWizards扩展点例子,模仿新建java项目
而我发的这个就是instantiations公司的主打产品《RCP.Developer.5.0.0》的注册机。RCP Developer是eclipse的一个插件,专门用来开发RCP应用的。现在时间是2010年4月8日12:32:28,我刚刚测试过,注册机可以正常使用,...
从零开始让你学会如何创建RCP富客户插件.
eclipse插件开发: rcp/swt相关资料 rcp swt 插件开发
AH8 labcar RCP路由NG.BLF.blf
The.Definitive.Guide.to.SWT.and.JFace.eBook-LiB [SWT/JFace开发指南]
RCP(RICH胖客户端)程序设计说明文档