Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path

Tags:

java

rxtx

I am trying to use the 64 bit rxtx serial communication library (downloaded from cloudhopper) with 64bit windows 7 and eclipse. I get the message: java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path. The dlls are in the /jre/lib dir as well as the Windows/System32. The RXTXcomm.jar is in the build path for eclipse as well as in the jre/lib/ext dir. I ran process monitor in the background and and see that RXTXcomm.jar, rxtxSerial.dll, and rxtxParallel.dll are all found and have been opened, So I am unclear as to why this problem is occurring.

Any suggestions.

like image 507
sldahlin Avatar asked Nov 19 '11 21:11

sldahlin


People also ask

How to add rxtxSerial in java library path?

Go to Project -> properties -> Java build path ->Find your . jar. Click on + to open the JAR's properties. Select Native library location and edit it to point to RXTX's shared library (.

What is UnsatisfiedLinkError in Java?

public class UnsatisfiedLinkError extends LinkageError. Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native .


8 Answers

Go to Project -> properties -> Java build path ->Find your .jar. Click on + to open the JAR's properties. Select Native library location and edit it to point to RXTX's shared library (.DLL, .so, .dylib).

like image 108
Paulo Gurgel Avatar answered Sep 20 '22 02:09

Paulo Gurgel


You can install librxtx-java package from repo for Ubuntu.

like image 36
GowhamanB Avatar answered Sep 22 '22 02:09

GowhamanB


You can also add a virtual machine argument:

-Djava.library.path=c:\path\to\dll\

or

-Djava.library.path=/path/to/lib/

That worked for me. Also refer to this question.

like image 39
Alberto de Paola Avatar answered Sep 19 '22 02:09

Alberto de Paola


Windows user : my problem was actually that I was placing the rxtxSerial.dll and the rxtxParallel.dll files in the wrong directory.

In my case, they were in [...]/jdk1.7.0_09/bin/ instead of [...]/jre7/bin/, although paths may differ for different versions of Java.

After all it's logic, if we want our JAR to run outside our IDE, we must have the dlls in our java running environment, not in our development environment :)

like image 30
aviggiano Avatar answered Sep 19 '22 02:09

aviggiano


I resolve this problem by adding rxtxSerial.dll[jre 1.8.0_45/bin] and RxTxcomm.jar[jre 1.8.0_45/lib/ext]

like image 44
A.P.Code Avatar answered Sep 19 '22 02:09

A.P.Code


Hy, I had the same problem when integrating the RXTXcomm into Netbeans under Ubuntu 11.10. I am guessing that you are not copying the files in the right place, at least that was my problem.

Under Ubuntu java is installed under usr/lib/jvm. BUT here I had a lot of forders (ex java-7-openjdk-i386, java-7-common, java-6-openjdk ...). In Netbeans I check what is the path of the JDK included into the project, it was java-7-openjdk-i386 . so I took the rxtxSerial.so (under windows it is rxtxSerial.dll) and copied it to java-7-openjdk-i386/jre/bin and it worked like a charm .

I hope this helps.

like image 31
Borissow Avatar answered Sep 18 '22 02:09

Borissow


I was having the same problem even after installing the RXTXcomm.jar in the Java\jdk\lib directory. Based on the instructions at http://www.jcontrol.org/download/readme_rxtx_en.html I located the rxtxSerial.dll and the rxtxParallel.dll files. Placing them in the bin directory did not help, but placing them in the lib directory along with the RXTXcomm.jar solved the problem.

like image 34
mkstlwtz Avatar answered Sep 21 '22 02:09

mkstlwtz


I had the same problem. So I installed JDK 32-bit and added those RxTx files(x86) to Program files(x86)/java/... folder instead of Program files/java... folder. Also I added those RxTx .dll files(x86) to /System32 folder. After that the problem was resolved in my application.

like image 24
Alias Neo Avatar answered Sep 22 '22 02:09

Alias Neo