Per default the RXTX library finds only serial devices on *nix systems that start with /dev/ttyS. On my RPi system the serial port is called /dev/ttyAMA0.
So if you enumerate all serial ports on a RPi System, the effective serial port is not found. You can resolve this issue either by modify your source:
1 | System.setProperty("gnu.io.rxtx.SerialPorts", "/dev/ttyAMA0"); |
or dynamic add this JRE option to your application:
1 | -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0" |
And if you’re looking for a low latency RXTX version you can grab it on my GitHub repo.