B4J Library jSerial library

Not open for further replies.
The jSerial library allows you to open and communicate with other devices through the computer COM ports.

It can also be used to communicate with Bluetooth devices over a virtual com port.
(jBluetooth library is now available: https://www.b4x.com/android/forum/threads/jbluetooth-library.60184/)


The attached examples implement an Android <-> PC chat app.

In order to run the example you need to first pair the PC and the device and make sure that the Bluetooth is mapped to a virtual com port.

jSerial works with AsyncStreams. Both standard mode and prefix mode are supported. Note that prefix mode can only work if both sides of the connection follow the protocol.
Change AStream.InitializePrefix to AStream.Initialize to disable prefix mode.

jSerial depends on an open source project named JSSC: https://github.com/java-native/jssc

v1.32 - Based on jssc v2.9.4.
v1.31 - Adds missing BAUDRATE, DATABITS, STOPBITS and PARITY constants.
v1.30 - Adds support for Java 11 and 64 bit computers based on: https://github.com/java-native/jssc

Instructions related to jSerial and B4J Packager 11: https://www.b4x.com/android/forum/threads/jserial-library.34762/post-735742


  • B4J_Chat.zip
    1.7 KB · Views: 4,988
  • B4A_Chat.zip
    9.2 KB · Views: 2,987
  • jSerial.zip
    500.3 KB · Views: 1,361
Last edited:


B4X founder
Staff member
Licensed User
Longtime User
jSerial and B4J Packager 11

jSerial depends on a native library named jssc.dll. It is included inside jssc.jar, under the natives folder. Remember that a jar file is actually a zip file.

This dll should be copied to build\bin folder, after you ran B4JPackager.
For your convenience the dll for Windows 64 bit is attached. Note that Windows 32 bit is not supported by Java 11+.

File is here: https://www.b4x.com/android/forum/t...-way-to-distribute-standalone-ui-apps.117880/
Last edited:
Not open for further replies.