Java(tm) Communications API Users Guide

Version 2.0

License

This document provides an overview of the components of the Java(tm) communications API, which is a standard extension to the Java platform. It is not a tutorial; readers should know the basics of serial and parallel port programming, and be comfortable reading the Java communications API reference pages.

Like all Java standard extensions, the Java communications API is intended to be implementable from specification by third parties.


javax.comm Extension Package

There are three levels of classes in the Java communications API:

The javax.comm package provides the following basic services:

A Simple Reading Example

SimpleRead.java opens a serial port and creates a thread for asynchronously reading data through an event callback technique.

A Simple Writing Example

SimpleWrite.java opens a serial port for writing data.

Solaris Notes

The Solaris implementation of the Java communications API requires the Solaris Native Threads Pack for JDK 1.1.x.

Here's how to test the SimpleRead.java example above on Solaris:

  1. Attach a null-modem cable between two serial ports.
  2. Start tip(1) on one of the serial ports:
  3. % tip -9600 /dev/term/b
  4. Compile SimpleRead.java:
  5. % javac SimpleRead.java
  6. Run SimpleRead:
  7. % java -native SimpleRead
  8. Type text into the tip(1) window.

Copyright © 1998 Sun Microsystems, Inc.
All Rights Reserved.