I had implemented a small Java tool to communicate with printer. First I thought I need to write a C driver or use JNI to connect to C code. But I found Java has solution.
The Java Communications API consists of the javax.comm package. This package does not come with the core Java development kits but instead is included in the set of optional Java Extensions packages that provide various useful services but are not available for all platforms.

With the Communications API you can obtain a set of objects representing the RS232 serial ports and IEEE 1284 parallel ports on a platform. With these you can obtain exclusive ownership of a port, read and write to the port either synchronously and asynchronously, and receive events from the port that indicate some state change in the port such as the arrival of data.

Ref:

Java Communications 3.0 API

Java Tech: The Java Communications API

Java Comm Serial API How-To for Linux

Opening up new ports to Java with javax.comm

Serial Programming:Serial Java

Physical Computing 

Advertisements