4

我尝试在 debian 上使用 rxtx 串行通信库,并且已将 librxtx.so 添加到本机库路径中,但仍然发生此异常。

    java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
    at com.vxoom.qit.basic.Log4jInit.startPrinterThread(Unknown Source)
    at com.vxoom.qit.basic.Log4jInit.init(Unknown Source)
    at javax.servlet.GenericServlet.init(GenericServlet.java:39)
    atwinstone.ServletConfiguration.ensureInitialization(ServletConfiguration.java:183)
    at winstone.WebAppConfiguration.<init>(WebAppConfiguration.java:918)
    at winstone.HostConfiguration.initWebApp(HostConfiguration.java:131)
    at winstone.HostConfiguration.<init>(HostConfiguration.java:73)
    at winstone.HostGroup.initHost(HostGroup.java:85)
    at winstone.HostGroup.<init>(HostGroup.java:45)
    at winstone.Launcher.<init>(Launcher.java:196)
    at winstone.Launcher.main(Launcher.java:391)
4

4 回答 4

3

对我来说,解决方案是将库的链接复制到 jvm 可以看到的地方,如下所示:

cp '/usr/lib/jni/librxtxSerial.so' '/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386'
于 2013-06-20T13:48:44.070 回答
0

我将复制并粘贴 rxtx INSTALL 帮助

Solution 1: move the file to a place that works

     $ mv /usr/local/lib/librxtxSerial.* /usr/local/java/jre/lib/i386/

Solution 2: add the location of librxtxSerial to LD_LIBRARY_PATH

     $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/

Solution 3: pass the location in on the command line

     $ java -Djava.library.path=/usr/local/lib/ ...

资源

http://rxtx.qbang.org/pub/rxtx/rxtx-2.1-7pre17/INSTALL

于 2013-05-16T14:16:08.647 回答
0

您需要将 rxtxSerial.dll 放入 jreXX/bin 文件夹

于 2013-11-05T15:12:11.550 回答
0

设置LD_LIBRARY_PATH为您拥有该.so文件的目录。

让您拥有 .so文件的目录是/home/abc

使用这个命令:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/home/abc"

在java中以以下方式加载.so..

System.loadLibraryPath("rxtxSerial");

要永久设置它,您必须将同一行放入.profile主目录中的文件中。

你可以参考这个指南

于 2012-12-19T09:54:04.190 回答