Go Down

Topic: Interfacing with Java - Jar problems (Read 779 times) previous topic - next topic

Terraviper-5

Aug 10, 2012, 04:22 am Last Edit: Aug 10, 2012, 04:27 am by Terraviper-5 Reason: 1
Hi!

I have been trying to send signals to my Arduino Uno via serial port using Java and rxtxSerial.dll library. After a few problems, I have managed to do so and it worked flawlessly (if I count out 30 second long scan of ports because I couldnt find fixed 64-bit version of the library). From NetBeans. As soon as I try to run my program from jar, I (again) get this error:

Code: [Select]

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while
loading gnu.io.RXTXCommDriver
Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: no rxtxSerial 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:83)
       at SerialDriver.initialize(SerialDriver.java:27)
       at Clock.run(Clock.java:11)


I have been getting this error before I found out that I have to put rxtxserial.dll into c:/program files/java/jdk1.7.0_03/jre/bin and rxtxcomm.jar into c:/program files/java/jdk1.7.0_03/jre/lib/ext. After that, it worked. But as soon as I wanted to run my app standalone, I get this error. Can anybody help me please? Thanks!

PS: NetBeans has included the RXTXcomm.jar in accompanying lib folder.

Terraviper-5

Ok, found out what the problem was. NetBeans uses different Java Runtime Environment for app development than these apps use later when they are run standalone. This JRE is built in JDK. Therefore these two files are required in the exact same place in the standalone JRE too, not only in JDK's JRE.

Go Up