Fazecast/jSerialComm
FreePlatform-independent serial port access for Java
FreeFree tier
About Fazecast/jSerialComm
jSerialComm is a platform-independent serial port access library for Java, enabling developers to communicate with serial devices (RS-232, RS-485, etc.) across Windows, Linux, and macOS. It provides a simple API via the SerialPort class, supports multiple build systems (Maven, Gradle, Ivy, SBT), and offers features like native library extraction customization and compatibility with Java 24+ through JVM flags. The library is open source under LGPL and Apache 2.0 licenses.
Key Features
Cross-platform support (Windows, Linux, macOS)
Simple SerialPort API for serial communication
Maven Central integration with multiple build system declarations
Customizable native library loading and extraction
Compatibility with Java 24+ via --enable-native-access flag
Support for multiple serial port enumeration and configuration
Pros & Cons
Pros
- True cross-platform portability without code changes
- Easy to integrate via Maven Central and popular build tools
- Actively maintained open source project with permissive licensing
- Comprehensive wiki and usage documentation available
Cons
- May require additional JVM flags (--enable-native-access) for Java 24+
- Native library extraction can pose challenges in restricted environments
- Potential configuration needed for Apache Tomcat or multi-application setups
Best For
Serial communication in Java applicationsIoT and embedded systems connectivityIndustrial automation and control systemsBuilding custom serial data acquisition or logging software
FAQ
How do I include jSerialComm in my project?
Add the dependency from Maven Central using your build system's declaration (e.g., Maven, Gradle, Ivy, SBT). The version range [2.0.0,3.0.0) is recommended.
Does jSerialComm support the latest Java versions?
Yes. Starting with Java 24, you may need to pass the JVM flag --enable-native-access=com.fazecast.jSerialComm or --enable-native-access=ALL-UNNAMED to allow native code access.
Can I use jSerialComm in an Apache Tomcat application?
Yes, but set the system property jSerialComm.library.randomizeNativeName to true before accessing the SerialPort class to avoid reinitialization issues.