我尝试在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)
答案 0 :(得分:3)
对我来说,解决方案是将链接复制到jvm可以看到的库:
cp '/usr/lib/jni/librxtxSerial.so' '/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386'
答案 1 :(得分:0)
将LD_LIBRARY_PATH
设置为您拥有.so
文件的目录。
让您拥有.so
文件的目录为/home/abc
使用此命令:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/home/abc"
在java中以下列方式加载.so ..
System.loadLibraryPath("rxtxSerial");
要永久地设置它,您必须在.profile
文件中放入相同的行
这将在您的主目录中。
答案 2 :(得分: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/ ...
来源
答案 3 :(得分:0)
您需要将rxtxSerial.dll放入jreXX / bin文件夹