Coach Thrasher

Thursday Sep 15, 2005

Java Communications API Notes

I had tried to get RXTX to work with the old Sun Solaris native drivers with no luck. I don't know if the problem was due to my use of JDK 1.5.0, or my os, or my fumbling. In any event, Sun has updated their communications api to version 3, and they've released a Linux/Solaris version. If in doubt, install the latest version?... we'll see.

Here are the notes from my install of Sun's Java Communications API (for Linux). I was successful quite quickly, so hopefully these will be useful to others.

My starting platform:

  1. Fedora Linux Core 3
  2. Sun's Java SDK, v1.5
  3. Tyan Tiger MPX mainboard with two known-working serial ports

Installation:

  1. Download the API
  2. unpack the download:
    unzip comm3.0_linux.zip
  3. read, but don't execute, the linux instructions:
    firefox commapi\docs\html\platform\linux\PlatformSpecific.html
  4. install the library:
    cp commapi/lib/libLinuxSerialParallel.so 
    JAVA_HOME/jre/lib/i386/libLinuxSerialParallel.so
  5. install the jar:
    cp commapi/jar/comm.jar 

    JAVA_HOME/jre/lib/ext/comm.jar

Now that the API has been installed, we can run the BlackBox test:


mkdir test

cd test

cp ../commapi/jar/tools/BlackBox.jar .

cp ../commapi/docs/portmap.conf_example.txt portmap.conf

cp ../commapi/docs/javax.comm.properties .

export CLASSPATH=.:BlackBox.jar

java -Dprops BlackBox

At this point, if you are logged into linux locally, or of you are working over an ssh session with X11 port forwarding turned on (cygwin), you should see a window popup with a serial port gui. My motherboard has two serial ports, and the gui has matching sections for each.

WARNING: If your serial ports are currently being used by another application (maybe your UPS?), Java will kick the other app off of the port, and take ownership on it's own. This is a known feature of the API, see it's documentation for details.

On another note, I tried following Sun's installation instructions, but I kept getting the error:


javax.comm:  Error loading javax.comm.properties!

null



java.io.IOException: javax.comm: platform driver class name = null

                     (Check 'driver' property in javax.comm.properties)



        at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:243)

        at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109)

        at BlackBox.main(Unknown Source)

implementation version = 3.0

javax.comm.properties  = null

portmap.conf           = null

Driver class name      = null

Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive

        at com.sun.comm.SunrayInfo.isSessionActive(Native Method)

        at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155)

        at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100)

        at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138)

        at BlackBox.main(Unknown Source)

It appears that the javax.comm.properties file was not being found. It finds it just fine if it's in the local directory and classpath, but not when it is installed to
JAVA_HOME/jre/lib per Sun's docs.

I also found that the portmap.conf file needs to live in the local directory and classpath. This file is not mentioned in Sun's API install notes.







Comments:

3Q for U experience, i am sorry because of my poor english.i built the Applet for bankbook printer in windows(javax.comm.jar 2.0),it's fine but error when i change it to javax.comm.jar 3.0 for linux in RH AS 4.0,it report "error loading javax.comm.properties",i cp javax.comm.properties and portmap.conf to $JAVA_HOME/jre/lib,and cp comm.jar to $JAVA_HOME/jre/lib/ext,then i open firefox to load the applet,but the same error to.would you give some suggestion,thanks~,good day.

Posted by debugger on January 15, 2007 at 03:53 AM PST #

javax.comm: Error loading javax.comm.properties!
null

java.io.IOException: javax.comm: platform driver class name = null
(Check 'driver' property in javax.comm.properties)

at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:244)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:109)
at SerialToGsm.<init>(SerialToGsm.java:44)
at SerialToGsm.main(SerialToGsm.java:220)
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.comm.SunrayInfo.isSessionActive()Z
at com.sun.comm.SunrayInfo.isSessionActive(Native Method)
at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155)
at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:138)
at SerialToGsm.<init>(SerialToGsm.java:44)
at SerialToGsm.main(SerialToGsm.java:220)

Posted by arun prabhath on May 20, 2009 at 03:30 AM PDT #

I also got the above error posted by myself. Please give me a solution

Posted by arun prabhath on May 20, 2009 at 03:31 AM PDT #

java -cp comm.jar:commtest.jar:. SerialToGsm
this is how I attempted to run the java code

Posted by arun prabhath on May 20, 2009 at 03:33 AM PDT #

I recently came accross your blog and have been reading along. I thought I would leave my first

comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep

visiting this blog very often.so you also can read my website,if you like

Posted by cheap ugg boots on December 24, 2009 at 07:26 PM PST #

Good post, I would like to leave a comment, because it gives more bloggers who participate

and the opportunity to perhaps learn from each other.

Posted by Air Jordan shoes on April 09, 2010 at 06:16 PM PDT #

One more i want to say is, people will give their comment if they are understand what they read. In my opinion, people who read without understand seems won’t give their comment and just type ‘nice post’ or ‘great job’<a href="http://www.ed-hardy.cc/">ed hardy clothing</a>**

Posted by cheap nfl jerseys on April 28, 2010 at 08:53 PM PDT #

My initially occasion in which to attend your trusty post ,I actually come across the weblog is definitely total of extremely and manner,and so happy for me.Additionally,say thanks to you for sharing the beneficial views to me.

Posted by Shox NZ on May 07, 2010 at 08:20 PM PDT #

My initially occasion in which to attend your trusty post ,I actually come across the weblog is definitely total of extremely and manner,and so happy for me.Additionally,say thanks to you for sharing the beneficial views to me.

Posted by Shox NZ on May 07, 2010 at 08:35 PM PDT #

good

Posted by Nike Jordan Shoes on May 19, 2010 at 12:57 AM PDT #

I am very interested in the write's view on the leisure. As people's living conditions are increasingly favorable, diversified recreations are accepted by people. Here are some sits can buy to leisure-related products.

Posted by clothes shop on June 13, 2010 at 08:03 PM PDT #

What I got from your blog is very helpul for me. Thank you, may you a happy life.

Posted by Air force one on June 21, 2010 at 05:25 PM PDT #

Seeing your post come accorss in the online,form it remind me a large number of languge knowledge.Thank you.

Posted by Nike Shox R4 on June 21, 2010 at 08:04 PM PDT #

I'm an extremely faithful <a href="http://www.sneakers4sales.com/"> Nike Dunk Sb </a> admirers, thus I'm so love this viewpoint from the perfect blog. Maybe most people are put on <a href="http://www.sneakers4sales.com/nike-shox-men-88/"> Nike Shox Deliver </a> in the everyday life. Owing to the article that brings me various sense about this Air Jordans. How grateful to see what you have been shared on the internet. Wish you much better.

Posted by Nike Dunk Sb on July 28, 2010 at 06:06 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referrers