I’m using Eclipse IDE. with jssc-0.9.0 release and I have correctly added jssc.jar to Referenced Libraries. But when I run it, it’s always terminated.
Says “Main[Java Application]/usr/lib/jvm/java-6-openjdk-i386/bin/java”
this is my code
import jssc.SerialPortList;
public class Main {
public static void main(String[] args) {
String[] portNames = SerialPortList.getPortNames();
for(int i = 0; i < portNames.length; i++){
System.out.println(portNames[i]);
}
}
}
I had the similar problem, so I examined the jssc code and found out that in linux the SerialPortList.getPortNames() parses dmesg output for port names starting with ‘ttyS’ or ‘ttyUSB’ – but my only serial device was on ttyACM0 and of course the getPortNames function couldn’t find it… You may as well check if the jssc’s linux native library (libjSSC-0.9_x86.so) was extracted from jssc.jar to ~/.jssc/linux/ when you ran your code…