skip to main | skip to sidebar

Tuesday, March 29, 2011

Java Communications API – Configuration How To

Java Communication API is an extension from Sun to program for Serial/Parallel ports. Sun’s implementation of this specification can be found at "http://java.sun.com/products/javacomm", there is also a third party Open Source implementation available at "http://rxtx.qbang.org/wiki/index.php/Main_Page". Java is platform Independent, but you need some platform specific implementation to access Serial/Parallel ports, and that is why you need to do some extra work to use Java Communication API.
First download the API binaries from "http://rxtx.qbang.org/wiki/index.php/Download" page. Extract it and follow the steps given below for Windows platform.
If you are just trying execute programs already written using just JRE, then
  • Copy rxtxParallel.dll to JRE_HOME\bin\
  • Copy rxtxSerial.dll to JRE_HOME\bin\
  • Copy RXTXcomm.jar to JRE_HOME\lib\ext\
If you are writing you own applications/programs, compiling and executing them, then
  • Copy rxtxParallel.dll to JDK_HOME\jre\bin\
  • Copy rxtxSerial.dll to JDK_HOME\jre\bin\
  • Copy RXTXcomm.jar to JDK_HOME\jre\lib\ext\
You can skip the last step of copying "RXTXcomm.jar" to "..\jre\lib\ext" directory and adding it to your CLASSPATH yourself and bundling it with your application itself.
That is it, you can find more information about RXTX implementation at "http://rxtx.qbang.org/wiki/index.php/Main_Page" and about installation for different platforms like Linux, Mac at "http://rxtx.qbang.org/wiki/index.php/Installation".
Simple example about using Java Communications API will follow soon.
Read more »»