Let's now start exchanging data with the device we have to handle. Doing this requires that we receive and send some data over a serial port (or a virtual serial port over USB). This has always been a pain in the neck with Java. And Java 8 did not change this. We still have to install some separate piece of software, which depends on the platform where the application is being developed or run. The most frequently used solution is RXTX. And that's the one I use in my projects.
To install it on my Linux PC, I adhere to following steps:
- install package librxtx-java (version 2.2pre2-11)
- add /usr/share/java/RXTXcomm-2.2pre2.jar external JAR to the Eclipse project
- right-click on the jar in the list of referenced libraries in the Eclipse project, select Properties / Native Library and enter the directory containing native libraries: /usr/lib/jni