COM Port Access Example

Java allows to access serial ports of your computer upon adding an optional extension package. That package is curretnly available from Sun Microsystems for free both for Windows and Sun Solaris. Java 1.1.x or later is required.

The complete package consists of:

In order to use the library copy the three files listed above into the directory where you will develop and later run your Java program. More sophisticated instalation into one place, that would be common for all of your possible projects, is possible.

When compiling your program, include comm.jar in the class path. For example:

javac -classpath .;comm.jar COMPort.java
You do not need to include it when compiling classes that do not import directly the library features:
javac Test.java

When running your program, include comm.jar in the class path. For example:

java -classpath .;comm.jar Test

The program that was used here for the illustration can be used to control a telephone modem if one is connected to a serial port of yoru computer, or one that is installed inside your computer. The internal modems have an extra serial port that interfaces them to a copmputer. Each modem has an on-board embedded system, a microprocessor that you can talk to in some kind of ASCII protocol (callad also a Hayes protocol). If you are interested, here is a brief descrition of standard commands.

Download the complete example

web site front local main page local list page general bookmarks software bookmarks go back copyright info