Posts: 1
Joined: Thu Jan 19, 2017 8:49 pm

Serial Communication

Sat Jan 21, 2017 4:31 pm

Dear all,

I developed a Java application on my laptop on a debian linux.
The Java application communicate with a serial port, i used the rxtx library.
This application can be executed on raspberry pi (raspberry pi 2 model b) with raspbian?
Analyzing the following link https://blogs.oracle.com/jtc/entry/java ... _revisited
i think the portability is possible.

Any help will be very appreciated.

Best regards,

User avatar
Posts: 6073
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Serial Communication

Mon Jan 23, 2017 10:13 am

This application can be executed on raspberry pi (raspberry pi 2 model b) with raspbian?
Probably. Which java runtime are you using on your laptop ?

Posts: 66
Joined: Sat Nov 12, 2016 2:11 pm
Location: Voorschoten

Re: Serial Communication

Tue Jan 24, 2017 11:29 am

If all you want is open/close and read/write from your device, you don't need RXTX; i.e. just open /dev/ttyUSB or /dev/ttyAMA0(dependig on if you want to read a usb device or the internal serial device respectively). You can optionally set the device baud rate before you start the jvm (by using stty on the device).

The /dev/tty ... device presents itself to the jvm as if it were a file; it can be opened/closed read/written to as usual).
kind regards,


Posts: 9
Joined: Mon May 25, 2015 9:17 pm

Re: Serial Communication

Thu Jun 01, 2017 5:42 pm

If you want to do something more cross-platform, use JSerialComm - no messing about with RxTx dependencies and it's actively supported/developed
It wraps it's own native implementations and we have used it very successfully on enocean4j and j2mod.

Return to “Java”