如何配置RTXCommon.jar

时间:2015-05-16 17:46:37

标签: java

我有一个java程序,我想使用RTXCommon.jar所以如果我尝试使用它,我有这个错误

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while
loading gnu.io.RXTXCommDriver
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no rxtxSe
rial in java.library.path
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
        at com.mcsolution.easyMgmt.panel.utility.panelProgramma.inizializzaLabel
Text(panelProgramma.java:877)
        at com.mcsolution.easyMgmt.panel.utility.panelUtility.creaSwing(panelUti
lity.java:36)
        at com.mcsolution.esp.TestaFrameSalagiochi$MenuLookDemo22$1.actionPerfor
med(TestaFrameSalagiochi.java:118)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.AbstractButton.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$400(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

然后我右键单击项目,java构建路径,然后我找到RTXCommon.jar,选择Native Library Path,编辑,然后我选择文件夹C:\ SWInstall \ dll

在此文件夹中,我复制了rtxSerial.dll rtxParallel.dll。然后我运行项目并运作。但是如果我尝试生成jar文件然后运行它,我也有同样的错误。

我该如何解决?

问候

1 个答案:

答案 0 :(得分:0)

检查你没有提到的最重要的事情之一是验证你是否使用32位或64位的RTXCommon.jar,如果你使用的是java 82位,你应该使用RTXCommon .jar 32bits。

然后你必须检查RTXCommon.jar是否指向本机库的正确位置,为此,在eclipse下,右键单击你的项目并选择属性然后选择java build path,在对话框中单击RTXCommon.jar之前的小箭头。双击本机库位置并输入DLL的路径。

如果您愿意在不同的计算机上运行您的应用程序,请记住将您的DLL存储在一个公共文件夹中(在Windows程序文件下),以防止此类错误发生在其他用户身上。其他操作系统也是如此。