Hello
i googled about rs232 in java, but i got some
information that javax.comm.SerialPort isn't portable.
Is it still true that this only works on Windows?
I'm developping an application that needs to run
on Linux and Windows.
Please let me know.
(if you know some excellent resources about serial
programming in java, let me know also :-))
kind regards
Simone - 12 Mar 2004 11:37 GMT
Hello,
Prosper wrote on Fri, 12 Mar 2004 10:39:02 GMT:
> i googled about rs232 in java, but i got some
> information that javax.comm.SerialPort isn't portable.
>
> Is it still true that this only works on Windows?
> I'm developping an application that needs to run
> on Linux and Windows.
I think its possible to access the serial port on Linux.
Thats a point in the FAQ of JavaComm - it references to:
http://www.geeksville.com/~kevinh/linuxcomm.html
http://wass.homelinux.net/howtos/Comm_How-To.shtml
> (if you know some excellent resources about serial
> programming in java, let me know also :-))
Hava a look at
http://www.javaworld.com/javaworld/jw-05-1998/jw-05-javadev.html
for a short introduction.
good luck
S.
Dale King - 21 Mar 2004 23:31 GMT
> Hello
>
> i googled about rs232 in java, but i got some
> information that javax.comm.SerialPort isn't portable.
No, the Java Comm API was designed to be a portable API which could be
implemented on various platforms.
> Is it still true that this only works on Windows?
> I'm developping an application that needs to run
> on Linux and Windows.
Sun provided implementations for Windows and Solaris. There is an
open-source implementation called RXTX that has implementations for Windows,
Solaris, and Linux and supporting some other port types.
The real problem is that Sun produced the CommAPI back about 1998 and has
never touched it one iota since then. Their implementation has some very
stupid details requiring you to install 3 different files for example and
one of those files should not actually be needed, but is required anyway. It
is also pretty much unusable under WebStart without some hacks.
RXTX can be used with the CommAPI, but considering some of the shortcomings
of the CommAPI, I would say forget Sun's Comm API and just use RXTX through
its own API. It is easier to set-up and use.
--
Dale King
bronby - 14 Apr 2005 02:27 GMT
hey .. i'm a newbie in java...
i just searched google about serial programming in java...
i'm thinking if you could help me.
i got a new programming assignment in communicating with serial ports...
a handler that links a POS terminal with that of a bank equipment (pin
pad) .. connected in serial port...
could u help me?
i usually program using databases, reports, maintenance and stuff usin
other languages. but this one quite new to me even the concept of serial
port stuff.
can u give me idea on how to tackle this?
or even just an introduction to serial programming in simple words ..
hehe...
i'm using jbuilder as IDE on LINUX..
i think i successfuly installed java.comm already hehehe...
hope u guys could really help me
thanks.
Betty - 14 Apr 2005 03:59 GMT
> hey .. i'm a newbie in java...
>
[quoted text clipped - 19 lines]
> hope u guys could really help me
> thanks.
I have not tried this sort of thing yet, but I think you have
a fun time ahead. Much more so than just reports etc.
James Korman - 14 Apr 2005 04:26 GMT
>hey .. i'm a newbie in java...
>
[quoted text clipped - 19 lines]
>hope u guys could really help me
>thanks.
First thing if you haven't is download the commapi stuff
http://java.sun.com/products/javacomm/downloads/index.html
There are several good example programs in the demos.
The Linux support however doesn't seem to be all that great.
Another api
http://www.sc-systems.com/products/serialport/serialport.htm
is commerical, I haven't tried it, but it looks pretty good.
Jim
bronby - 20 Apr 2005 02:03 GMT
oh thanks... i've just downloaded java commm stuff ... i've tried running
this serialTest java program
it's "serial programming in java"
http://stage.itp.tsoa.nyu.edu/~dano/cgi/wiki.cgi?Connections
there's no syntax error but a run time error message
=========================
<begin of error msg>
54 1108548444
RXTX WARNING: This library requires the user running applications to be
in
group uucp. Please consult the INSTALL documentation. More information
is
avaiable under the topic 'How can I use Lock Files with rxtx?'
check_lock_status: No permission to create lock file.
please see: How can I use Lock Files with rxtx? in INSTALL
<end of error runtime error msg>
=============
ANYONE ENCOUNTERED THIS?
AND HOW WILL I FIX IT ?.. THANKS
Thomas Weidenfeller - 20 Apr 2005 08:09 GMT
> =========================
> <begin of error msg>
[quoted text clipped - 13 lines]
> ANYONE ENCOUNTERED THIS?
> AND HOW WILL I FIX IT ?.. THANKS
Please don't shout. This is considered rude on Usenet. Instead, please
read the error message again, an do what it tells you. Particular the
part telling you:
> This library requires the user running applications to be in group uucp.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
bronby - 20 Apr 2005 09:21 GMT
oops!
my apologies sir.
user is already in group uucp :(
can't also find install doc. it was referring to...
bronby - 20 Apr 2005 10:21 GMT
oops!
my apologies sir.
user is already in group uucp :(
can't also find install doc. it was referring to...
JScoobyCed - 21 Apr 2005 02:57 GMT
> oops!
> my apologies sir.
>
> user is already in group uucp :(
> can't also find install doc. it was referring to...
Download an older version of the lib, and the INSTALL file contains a
section:
T. How can I use Lock Files with rxtx?
Redhat users. Note that Redhat changed group uucp to group lock with
Redhat 7.2.
Mandrake users. Note that /var/lock needs to be group uucp for this to
work.
Mac OS X users. Note that you may need to create the lock directory
with group uucp ownership.
RXTX uses lock files by default. configure --disable-lockfiles to
generate rxtx libraries without lock files. Its strongly recommended
that you do use lock files to prevent rxtx from stomping on other
programs using serial ports.
Lock files are used to prevent more than one program accessing a port at
a time. Lock files require a bit of sysadmin to work properly..
Rxtx has support for lock files on Linux only. It may work on other
platforms but read the source before blindly trying it.
Before you use lock files you need to do one of two things:
1. Be the root or uucp user on your machine whenever you use rxtx
2. add the specific user that needs to use rxtx to the group uucp.
(preferred)
To add a user to the uucp group edit /etc/group as root and change the
following:
uucp::14:uucp
to something like:
uucp::14:uucp,jarvi
In this case jarvi is the login name for the user that needs to use lock
files.
Do not change the number (14). Whatever is in your group file is correct.
User jarvi in this case can now use rxtx with lock files.
The lock file code does not support kermit style lock files or lock files in
/var/spool. Its sure to fail if you're using subdirectories in /dev or
do not have /dev.
Still cant get things to run under a root account?
Vadim Tkachenko writes:
"Maybe you remember - couple of months back I've run into inability to
run the JDK 1.3+ from under root account. Today, absolutely suddenly,
something clicked in my head and the cause was found: libsafe. To make
JDK work, it is enough to disable libsafe (unset LD_PRELOAD)."
As another option it is possible to use a Lock File Server. In this
case, a server runs in group uucp or lock and rxtx then connects to
localhost to lock and unlock the port. The server and install
instructions can be found in src/lfd. RXTX will need to be configured
to use the server:
configure --enable-lockfile_server
Any user can then lock the ports if they are not already locked.
Good luck
---
JSC
bronby - 22 Apr 2005 03:29 GMT
It worked JScooby!!!! ...
Thanks everyone! ...
hmmnn.. someone told me like Joseph has mentioned to use java sockets...?
is that the same with that one program i tested ?
Joseph Dionne - 14 Apr 2005 11:59 GMT
> hey .. i'm a newbie in java...
>
[quoted text clipped - 19 lines]
> hope u guys could really help me
> thanks.
I make only one suggestion, consider using an IP to serial conversion
adapter and use Java socket classes. Devices such as these are widely
available, many for low cost. One example is the following.
http://www.taltech.com/products/tcpcom.html
IMHO serial communications is a dying art out side of device micro code,
and while your are in Linux today, implementing with Java sockets will
open new sales opportunities.
Joseph
bronby - 17 May 2005 07:09 GMT
hi joseph...
forgive me sir but i'm really new in this pinpad device interfacing and
with java too .
do u have any suggestion that i can read or further explore on it? a
simple program maybe or share a concept on this type of communication.?
thanx