Необходимо считать данные с com порта.
При попытке взаимодействия с портом выдает ошибку.
Попытка разобраться при помощи гугла принесла мало результатов.
import jssc.*;
public class ComPort {
private static SerialPort serialPort;
public static void main(String[] args) {
String[] portNames = SerialPortList.getPortNames();
for (String portName : portNames) {
System.out.println(portName);
}
serialPort = new SerialPort("COM8");
try {
serialPort.openPort();
serialPort.setParams(9600, 8, 1, 0);
byte[] buffer = serialPort.readBytes(10);
serialPort.closePort();
}
catch (SerialPortException ex) {
System.out.println(ex);
}
}
Вот что мне выдает:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=7880, tid=10968
#
# JRE version: Java(TM) SE Runtime Environment (17.0+35) (build 17+35-LTS-2724)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17+35-LTS-2724, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C [jSSC-2.8_x86_64.dll+0xb5db]
#
# 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:\IdeaProjects\ComPort2\hs_err_pid7880.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
Пробовал ставить разные версии jdk, как рекомендуют люди в интернете, но ошибка всегда одна.
Если кто сталкивался с такой проблемой, просьба помочь