博主你好我用了你的Java串口通信程序代码但是每次运行时在串口发送或者接受信息时都会崩溃停止运行能给我一点结局办法或者帮助吗
这是错误
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180004465, pid=15512, tid=9280
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.7+7 (17.0.7+7) (build 17.0.7+7)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (17.0.7+7, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C [rxtxSerial.dll+0x4465]
#
# 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:
# D:\����\serialportdemo-master\hs_err_pid15512.log
#
# If you would like to submit a bug report, please visit:
# https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
串口通信必须多线程,建议你接受到数据后如果是上位机通讯,用UDP更好一点。
不知道你这个问题是否已经解决, 如果还没有解决的话://添加学生功能
public boolean addStu(Stu s) {
//判断数组是否已满
if (index > stus.length - 1) {
return false;
}
stus[index++] = s;
return true;
}