JSSC exception: no libjssc in java.library.path
I used the JSSC Serial Connector and I got the following exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no libjssc in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:34)
at jssc.SerialPort.<init>(SerialPort.java:93)
at cl.raien.jssc.SerialExample.main(SerialExample.java:22)
Code:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jssc.SerialPort;
import jssc.SerialPortException;
public class SerialExample {
static Logger log = LoggerFactory.getLogger(SerialExample.class);
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
log.info(System.getProperty("java.library.path"));
SerialPort serialPort = new SerialPort("ttyUSB0");
try {
System.out.println("Port opened: " + serialPort.openPort());
System.out.println("Params setted: " + serialPort.setParams(9600, 8, 1, 0));
System.out.println("\"Hello World!!!\" successfully writen to port: " + serialPort.writeBytes("Hello World!!!".getBytes()));
System.out.println("Port closed: " + serialPort.closePort());
}
catch (SerialPortException ex){
System.out.println(ex);
}
}
}
I am using ubuntu 12.10 86x_64 and jssc install $ HOME / .jssc / linux / libjSSC-0.9_x86_64.so
In Eclipse, I set the jssc.jar to Native Library Location to point to that directory first. Then I put this file in my project root folder as scream3r.org says . Finally, I changed the filename to libjssc and libjssc.so .
Thanks in advance!
+3
source to share