Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.34k stars 287 forks source link

2.10 quits on windows, works on linux #558

Open MarkJeronimus opened 6 months ago

MarkJeronimus commented 6 months ago

When invoking SerialPort.getCommPorts() on Windows 10 [edit] 32 bit, the program exits without exception or any other message, as if by System.exit(). I have no idea how to check if there's an errorlevel.

On Linux, 2.10 works. On Windows, 2.7 works. [edit] On Windows, 2.11 works.

Test case:

    public static void main(String... args) {
        SerialPort[] commPorts = SerialPort.getCommPorts();

        System.out.println(commPorts.length + " comports found.");
        for (SerialPort commPort : commPorts) {
            String port = commPort.getSystemPortName();
            String desc = commPort.getPortDescription();

            System.out.println("Found comport: " + port + " (" + desc + ')');
        }
    }

Output:

C:\test\>java -jar test.jar

C:\test\>

Additional information:

C:\test\>java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) Client VM (build 25.271-b09, mixed mode)
MarkJeronimus commented 6 months ago

I just tested 2.11, which is not on the main webpage, and it works on Windows.

NorbertSandor commented 6 months ago

Maybe your Windows is 32bit? I have seen issues related to 32bit systems recently (e.g. https://github.com/Fazecast/jSerialComm/issues/555 and others).

MarkJeronimus commented 6 months ago

You are absolutely correct, but for me it seems to be fixed in 2.11.

NorbertSandor commented 6 months ago

You are lucky then :) As I read in the comments the issue is a tough one :( If you are not in a hurry maybe wait for and test the final 2.11.1 version as well...

hedgecrw commented 6 months ago

Yes, 2.11.1 will fix what appears to be a compiler optimization issue for Win32 users. Just for clarification, you said that 2.11.0 works for you, but not from the main webpage...what do you mean by that (i.e. what page are you referring to, and are you saying that 2.11.0 is working differently depending on where you got it from?)

MarkJeronimus commented 6 months ago

I mean that on the main web page I downloaded 2.10.0 today. I only found out about the existence of 2.11 when visiting the repository.

hedgecrw commented 6 months ago

Very odd. Are you still seeing 2.10.0 on that page? It's showing 2.11.0 for me (and it gets auto-updated upon each new release).

MarkJeronimus commented 6 months ago

It was showing 2.11 at the time I wrote the previous reply.