Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
itoobaykhan opened this issue Oct 3, 2023 · 2 comments
Closed
Labels
bug Something isn't working Waiting on OP

Comments

@itoobaykhan
Copy link

itoobaykhan commented Oct 3, 2023

Please provide a brief summary of the bug

I am trying to run to get response from serial port.
I have checked all the possible outcomes to fix this issue but I am unable to fix it.
Below is the error im getting again and again.

Screenshot 2023-10-03 090944

Please provide steps to reproduce where possible

import gnu.io.CommPortIdentifier;
import gnu.io.CommPort;
import gnu.io.SerialPort;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Scanner;

public class CommPortExample {
public static void main(String args[])
{
Scanner scanner = new Scanner(System.in);
System.out.println("Enter command: ");
String command = scanner.nextLine();
scanner.close();
String portName = "COM11";

    try{
        CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
        if (portIdentifier.isCurrentlyOwned())
        {
            System.out.println("Port is currently in use");
        }
        else {
            CommPort commPort = portIdentifier.open(CommPortExample.class.getName(), 2000);

            if (commPort instanceof SerialPort){
                SerialPort sP =(SerialPort)commPort;
                sP.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

                InputStream in = sP.getInputStream();
                OutputStream out = sP.getOutputStream();

                out.write(command.getBytes());

                byte[] buffer = new byte[1024];
                int len;

                StringBuilder response = new StringBuilder();
                while ((len=in.read(buffer)) >-1 )
            {
               response.append(new String(buffer, 0,len));
               if (response.toString().contains("Expected response"))
               {
                break;
               }
            }
            System.out.println("System Response: "+response.toString());
            sP.close();

            }

            else
            {
                System.out.println("Error");

            }
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}

}

Expected Results

Enter command:
O0265Z

The device connected to usb port will beep after getting this command

Actual Results

Enter command:
O0265Z

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

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180005b00, pid=32216, tid=8300

JRE version: OpenJDK Runtime Environment Temurin-17.0.8.1+1 (17.0.8.1+1) (build 17.0.8.1+1)

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

Problematic frame:

C [rxtxSerial.dll+0x5b00]

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

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.

What Java Version are you using?

1.8.0_381

What is your operating system and platform?

Windows 11 pro version 22H2
Using VS Code x64-1.82.2

How did you install Java?

https://www.java.com/en/download/

DOwnload from here and install it

Did it work before?

No response

Did you test with the latest update version?

No response

Did you test with other Java versions?

No response

Relevant log output

No response

@itoobaykhan itoobaykhan added the bug Something isn't working label Oct 3, 2023
@karianna
Copy link
Contributor

karianna commented Oct 5, 2023

@itoobaykhan That's a crash in the native code in the rxtxSerial.dll library. You'll need to report this issue to that library.

@itoobaykhan
Copy link
Author

Oh okay. Thank you. I'll report it.

@karianna karianna closed this as completed Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Waiting on OP
Projects
None yet
Development

No branches or pull requests

2 participants