Java Comm API in FreeBSD? HELP!!!

I'm doing a project for my company that needs to access the serial port, with commAPI the thing works flawlessly under Windows XP, however big problem comes with commAPI doesn't work in FreeBSD which the company server runs on. This is what I have done so far :

Downloaded the Linux version of comm3.0, and extracted the .so files into /usr/local/java/jre/lib/i386/ directory, the comm.jar into /usr/local/java/jre/lib/ext/ directory, and the javax.comm.properties into /usr/local/java/jre/lib/ directory. The test program compiled fine, but during running it says no port found.

So I fumbled around and edited the javax.comm.properties file to make the serial port entry cuaa0, and now it finds the port fine, but when it tries to open the port, an error pops up like this

Exception in thread "main" java.lang.RuntimeException:

Error opening "/dev/cuaa0"

lockf(): Invalid argument

at com.sun.comm.LinuxDriver.getCommPort(LinuxDriver.java:66)

at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:369)

at nulltest.<init>(nulltest.java:133)

at nulltest.main(nulltest.java:76)

It seems the getCommPort method calls a lockf() function with an invalid argument? Now I'm at a loss of what to do, anyone has any idea how can this be fixed? Thanks!

[1329 byte] By [deuwella] at [2007-11-27 9:44:54]
# 1
I have tried using some older comm.jar with no luck, also tried the java-commapi-freebsd but seems it doesn't work?
deuwella at 2007-7-12 23:52:31 > top of Java-index,Java Essentials,Java Programming...
# 2
It appears there are a number of ports of comm packages to FreeBSD, see the referenced page. RXTX is one that works well in other environments. http://www.freebsdsoftware.org/comms/
ChuckBinga at 2007-7-12 23:52:31 > top of Java-index,Java Essentials,Java Programming...
# 3

> It appears there are a number of ports of comm

> packages to FreeBSD, see the referenced page. RXTX is

> one that works well in other environments.

>

> http://www.freebsdsoftware.org/comms/

I tried java-commapi-freebsd, but it also reports an error when opening the port

FreebsdSerial: UnsatisfiedLinkError = /usr/local/java/jre/lib/i386/libSerial.so: /usr/local/java/jre/lib/i386/libSerial.so: ELF file OS ABI invalid

java.lang.UnsatisfiedLinkError: /usr/local/java/jre/lib/i386/libSerial.so: /usr/local/java/jre/lib/i386/libSerial.so: ELF file OS ABI invalid

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503)

at java.lang.Runtime.loadLibrary0(Runtime.java:788)

at java.lang.System.loadLibrary(System.java:834)

at org.freebsd.io.comm.FreebsdSerial.<clinit>(FreebsdSerial.java:85)

at org.freebsd.io.comm.FreebsdDriver.getCommPort(FreebsdDriver.java:114)

at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:634)

at ATTest2.main(ATTest2.java:27)

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

at org.freebsd.io.comm.FreebsdSerial.deviceOpen(Native Method)

at org.freebsd.io.comm.FreebsdSerial.<init>(FreebsdSerial.java:115)

at org.freebsd.io.comm.FreebsdDriver.getCommPort(FreebsdDriver.java:114)

at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:634)

at ATTest2.main(ATTest2.java:27)

And then I tried RXTX, but it seems that tere's some problem to send the cartridge return character, so I can't send the AT commands properly to get any response. I tried \r \r\n \x0d etc. to no avail. Any idea what's the problem with the java-commapi-freebsd thing, or how to send the AT commands properly with RXTX? Thanks a lot!

deuwella at 2007-7-12 23:52:31 > top of Java-index,Java Essentials,Java Programming...
# 4
anyone? thanks!
deuwella at 2007-7-12 23:52:31 > top of Java-index,Java Essentials,Java Programming...