Talk:Serial Programming/Serial Java

Inactive Links to RxTx homepage
I have noticed that the homepage of RxTx (rxtx.qbang.org/wiki/) is malfunctioning, i wrote an e-mail to a support address found through the waybackMachine, some of the links on this page link to this page, i will wait a while to give them a chance to fix it. If they don't fix it i will modify the links to link to the archived version of the website. But i don't really think the page will come back online because the last version (2.2pre2) was published 2008 and the jRxTx (https://github.com/openmuc/jrxtx) page says development has ended fully. If i forget to make the changes by the end of 2017 it would be nice of anyone reading this to do it for me. --Friedr (discuss • contribs) 12:21, 7 May 2017 (UTC)

Hello,

I'm currently learning basics of using Java for serial communication on Linux. I couldn't get JavaComm to find /dev/ttyS0, so I've downloaded Sun's SimpleRead.java (http://java.sun.com/developer/releases/javacomm/SimpleRead.java) and modified in the following way: ... portId = (CommPortIdentifier) portList.nextElement; System.out.println("Found a port named " + portId.getName); if (portId.getPortType == CommPortIdentifier.PORT_SERIAL) { ... It turned out, that on my machine serial ports are named COMx with x being a number 1-8.

This naming convention seems consistent with the contents of javax.comm.properties which reads on my machine: ... ... Therefore I'd propose adding a warning to other newbies in "Finding the desired serial Port" paragraph, that they should not neccessarily expect JavaComm port names to correspond to the OS level port names.
 * 1) Port numbers are sequentially allocated to all devices found that correspond
 * 2) to these devices.
 * 3) For example if you specify the prefix /dev/ttyS=PORT_SERIAL
 * 4) and the following devices exist
 * 5) /dev/ttyS0
 * 6) /dev/ttyS1
 * 7) then they will be allocated COM1 and COM2 respectively

My observations may or may not relate to the software that I'm using, so for reference I tested this on IBM Java Runtime Environment 1.4.2, JavaComm is provided by java-1.4.2-ibm-javacomm rpm package and I'm running them on Red Hat Enterprise Linux Workstation 4 update 3.

Regards, Paweł Brodacki

Hello

I will also add that in order to properly compile this code is necesary to add this line at the begin. import java.io.*;

Also, I think variable motoPort is not previously defined.

Best Regards, Javier Sanchez. --

Hiho. classes cannot be synchronized see: http://download.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html

in part A simple, thread-safe Ring Buffer Implementation you have to synchronize all the methods not the class, i think

cheers Johann

is there a date on this entry & mods? since people are now/still saying that javax.comm is KAPUT it would be good to have a date. In general: Books have dates, Internat rants often do not, making them barely useful cts 21Sep2010

the very first pat of the demo fails:

while (portIdentifiers.hasMoreElements) { CommPortIdentifier pid = (CommPortIdentifier) portIdentifiers.nextElement; System.out.println("port " + pid.getName); prints nothing  21Sep2010