`
yjercou
  • 浏览: 3407 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

RCP加载SWT.DLL的异常

阅读更多

异常如下:

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:

  1. Put swt.dll in the same directory as the program.
  2. Put swt.dll in the JAVA_HOME\bin\ directory.
  3. 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放在根目录下。

 

当然也许还有更好的办法,希望拍砖!

分享到:
评论

相关推荐

    开发项目用SWING与RCP与SWT.JFACE的分析

    3. **JNI本地库**:根据操作系统平台找到对应的本地库文件,如Windows下的SWT-WIN32-2116.DLL或Unix下的SWT-LINUX-x86_64-4704.so等。 4. **编译与运行**:确保CLASSPATH中包含SWT.JAR,并设置`java.library.path`以...

    org.eclipse.wb.swt.SWTResourcemanager类找不到使用不了

    标题 "org.eclipse.wb.swt.SWTResourceManager类找不到使用不了" 描述了开发人员在尝试将一个基于Eclipse RCP(Rich Client Platform)的应用程序移植到IntelliJ IDEA时遇到的问题。SWT(Standard Widget Toolkit)是...

    学习SWT,RCP的笔记.doc

    ### SWT与RCP基础知识 #### 一、SWT概述 SWT(Standard Widget Toolkit)是一种专为Java设计的用户界面工具包,它提供了一系列的原生控件来创建丰富的客户端应用。SWT的一个显著特点在于它能直接调用操作系统的GUI...

    org.eclipse.equinox.p2.examples.rcp.prestartupdate.rar

    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....

    swt原生库(用java开发swt用)

    这些文件通常以`.dll`(Windows)、`.jnilib`(Mac OS X)或`.so`(Linux)的形式存在,它们是Java代码调用本地系统资源的桥梁。开发者需要根据目标平台选择合适的库文件,将它们添加到项目的类路径中,以便在运行时...

    org.eclipse.equinox.p2.examples.rcp.cloud.rar

    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.sdkbundlevisibility.rar

    \org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.rar \org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.rar v

    swt&jface&rcp.chm.rar

    SWT (Standard Widget Toolkit)、JFace 和 RCP (Rich Client Platform) 是 Java 开发桌面应用程序的重要工具包,尤其在...而 "swt&jface&rcp.chm" 文件则可以帮助开发者深入学习这些技术,掌握其精髓,提升开发技能。

    swt.rar_SWT_rcp

    SWT (Standard Widget Toolkit) 和 RCP (Rich Client Platform) 是Java编程中用于构建桌面应用程序的两个重要技术。本文将详细介绍这两个概念以及它们在实际应用中的相关知识点。 SWT是Eclipse基金会开发的一个开源...

    sqlexplorer_rcp-3.6.1.win32.win32.x86.zip

    《SQL Explorer RCP 3.6.1 for Windows 32-bit: 深入解析与应用指南》 SQL Explorer RCP 3.6.1 是一个专为Windows 32位系统设计的数据库管理工具,它基于Eclipse平台,为用户提供了一套直观且功能强大的SQL查询和...

    swt-win-x64-x32.rar

    4. **使用OSGI**:Eclipse RCP应用通常使用OSGi框架,此时SWT库的加载会更加复杂,可能需要配置Bundle-ClassPath和DynamicImport-Package等。 5. **检查IDE配置**:确保IntelliJ IDEA的项目结构设置正确,尤其是...

    rcp自己通过扩展点新建java项目

    class="com.example.rcp.wizard.MyJavaProjectWizard" icon="icons/sample.gif" id="com.example.rcp.wizard.NewJavaProjectWizard" name="New RCP Java Project"&gt; ``` 3. **实现向导类**:根据`class`...

    instantiations主打产品《RCP.Developer.5.0.0》注册机(2010年4月8日测试有效)

    而我发的这个就是instantiations公司的主打产品《RCP.Developer.5.0.0》的注册机。RCP Developer是eclipse的一个插件,专门用来开发RCP应用的。现在时间是2010年4月8日12:32:28,我刚刚测试过,注册机可以正常使用,...

    Eclipse RCP 打印表格.zip

    在Eclipse RCP中,表格组件通常使用 SWT (Standard Widget Toolkit) 或 JFace 的 TableViewer 类来创建。SWT 是一个与平台无关的库,提供了与操作系统原生控件的直接交互,而JFace是基于SWT的更高级抽象,简化了UI...

    eclipst.swt.rcp

    从零开始让你学会如何创建RCP富客户插件.

    AH8 labcar RCP路由NG.BLF.blf

    AH8 labcar RCP路由NG.BLF.blf

    org.eclipse.equinox.p2.examples.rcp.sdkui.rar

    标题中的"org.eclipse.equinox.p2.examples.rcp.sdkui.rar"是一个压缩文件,它包含了Eclipse Equinox P2的一个示例,专门针对基于RCP(Rich Client Platform)的应用程序的软件开发工具包(SDK)用户界面。...

    RCP学习资料.zip

    3. **SWT和JFace**:RCP应用的UI通常使用SWT(Standard Widget Toolkit)和JFace库来构建。SWT是Eclipse提供的底层GUI库,提供了丰富的控件和事件处理机制。JFace是在SWT之上的一层抽象,简化了UI开发,提供了数据...

Global site tag (gtag.js) - Google Analytics