• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RS232 and Java

 
Ranch Hand
Posts: 85
Mac Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just wanted to share my experience with the ranchers in case someone may have deal with this. It is not readily apparent when googling what someone has to do in order to connect to and communicate with serial ports. Javax.com, from what I understand is deprecated, although people seem to use it with varying degrees of success. The other option that I found was RXTX. I am using Ubuntu 32bit and Eclipse; my need was to use RS232. To use the API, download the Linux/x86 archive from the Downloads page and point your build path to the jar file which resides in the extracted folder. In addition, you have to associate a native .so file with the rxtx.jar file in order for the code to access the OS devices. For whatever reason, the only packed .so files were for 64 bit OS'. Upon running the file I got an ELF (EFL?) error which apparently means I was using a 64bit .so file on a 32 bit machine. I poked around their "toybox" directory and found a Linux 386 .so file that you can find here. Point to that .so file in the rxtx.jar file in hte native code path (In eclipse, Project Build Path). After that, I used this example to help me test and learn the API.

In most cases, I would recommend getting a Rs232 to Ethernet Server, assign it an IP and go to town using socket connections. It's a far more flexible solution imo.

In this case, I had a device that had an embedded USB to serial drive so it was connected to a USB port, yet the OS recognized it as a COM port; specifically /dev/ttyUSB0. The rxrtx api helped me access and communicate with the device.


Hope this helps folks!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for sharing your knowledge.

ELF (Executable and Linkable Format) is a common file format for executable programs and libraries that's used on several Unix-like operating systems, including Linux.
 
catch it before it slithers away! Oh wait, it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic