Java library issue with java 25

I am having issues using the java library.
I am using the libs from the latest release 1.3.2.
All jars are in my classpath, and the rxtxSerial.dll is in the bin folder of my JDK 26.
I have imported the dependencies from the release package directly as explained here.
I am on windows 11.
I run the sample from the library repo /communication/ReceiveDataSample

I have the following error when running the application.


C:\Users\ozgun.jdks\openjdk-26\bin\java.exe “-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2024.1\lib\idea_rt.jar=55249” -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\Users\ozgun\workspace-java\TestXbee\target\classes;C:\Users\ozgun\workspace-java\TestXbee\lib\rxtx-2.2.jar;C:\Users\ozgun\workspace-java\TestXbee\lib\slf4j-api-1.7.12.jar;C:\Users\ozgun\workspace-java\TestXbee\lib\slf4j-jdk14-1.7.12.jar;C:\Users\ozgun\workspace-java\TestXbee\lib\slf4j-nop-1.7.12.jar;C:\Users\ozgun\workspace-java\TestXbee\lib\slf4j-simple-1.7.12.jar;C:\Users\ozgun\workspace-java\TestXbee\lib\xbee-java-library-1.3.2.jar org.example.Main
±----------------------------------------+
|  XBee Java Library Receive Data Sample  |
±----------------------------------------+

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/ozgun/workspace-java/TestXbee/lib/slf4j-jdk14-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/ozgun/workspace-java/TestXbee/lib/slf4j-nop-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/ozgun/workspace-java/TestXbee/lib/slf4j-simple-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
Mar 28, 2026 6:52:34 PM com.digi.xbee.api.AbstractXBeeDevice open
INFO: [COM5 - 9600/8/N/1/N] Opening the connection interface…
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::loadLibrary has been called by gnu.io.RXTXCommDriver in an unnamed module (file:/C:/Users/ozgun/workspace-java/TestXbee/lib/rxtx-2.2.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

WARNING:  RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Mar 28, 2026 6:52:35 PM com.digi.xbee.api.AbstractXBeeDevice open
INFO: [COM5 - 9600/8/N/1/N] Connection interface open.



A fatal error has been detected by the Java Runtime Environment:



EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000001800044cb, pid=8268, tid=26892



JRE version: OpenJDK Runtime Environment (26.0+35) (build 26+35-2893)

Java VM: OpenJDK 64-Bit Server VM (26+35-2893, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)

Problematic frame:

C  [rxtxSerial.dll+0x44cb]



No core dump will be written. Minidumps are not enabled by default on client versions of Windows



An error report file with more information is saved as:

C:\Users\ozgun\workspace-java\TestXbee\hs_err_pid8268.log

[thread 27944 also had an error]
[0.326s][warning][os] Loading hsdis library failed



If you would like to submit a bug report, please visit:






The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.



Process finished with exit code 1

Can you please help ?
Cheer,
OZ

For information, I have managed to remove the warning by downloading an old native lib version RXTX-2.2pre1 from the archives here

But this did not solve the error.
I think there is an issue with this lib with the latest version of windows / JDK.

The XBee Java Library was written on Java 7. which is not directly compatible with Java 21 - 25. An AI scan of the message and associated code give the following as the primary fix.

:1st_place_medal: Option 1 — Use an older Java version (FASTEST FIX)

This is what Digi implicitly expects.

:backhand_index_pointing_right: Use:

  • Java 8 (best)

  • Java 11 (sometimes works)

:check_mark: Steps

  1. Install Java 8

  2. Set it:

java -version
  1. Re-run your code

:backhand_index_pointing_right: This alone usually fixes the crash.


:2nd_place_medal: Option 2 — Replace RXTX (BEST LONG-TERM FIX)

RXTX is the real problem.

Use:

:backhand_index_pointing_right: NRJavaSerial

Why this works

  • Drop-in replacement for RXTX

  • Works with modern Java

  • No native crashes

Maven:

<dependency>
  <groupId>com.neuronrobotics</groupId>
  <artifactId>nrjavaserial</artifactId>
  <version>5.2.1</version>
</dependency>

Then:

  • Remove:

    • RXTXcomm.jar

    • rxtxSerial.dll

:backhand_index_pointing_right: The Digi library will automatically use NRJavaSerial instead

Hey thanks for the reply. that’s actually what I ended up doing on my fork. it’s a pity that the library did not fix this issue since a while because I see lots of posts in this forum and even on SO for the same problem, and people end up doing the same fix on their side instead of capitalizing on a single solution (fixing the library and reusing it)

FYI There are several posts in this forum pointing to the same problem.