Reputation: 513
I trying to use rxtx serial communication library on debian and I have added librxtx.so into native library path but still this exception is occurred .
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)
Upvotes: 4
Views: 8374
Reputation: 2451
Set LD_LIBRARY_PATH
to the directory where you have the .so
file.
Let the directory in which you have the .so
file is /home/abc
Use this command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/home/abc"
In java load the .so in the following manner..
System.loadLibraryPath("rxtxSerial");
To set it permanently you have to put the same line in .profile
file
which will be in your home directory.
Upvotes: 0
Reputation: 31
For me the solution was to copy the link to the library to where the jvm can see it like so:
cp '/usr/lib/jni/librxtxSerial.so' '/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386'
Upvotes: 3
Reputation: 6908
I will copy and paste the rxtx INSTALL help
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/ ...
Source
http://rxtx.qbang.org/pub/rxtx/rxtx-2.1-7pre17/INSTALL
Upvotes: 0