type "jtermios.windows.WinAPI$ULONG_PTR" is not supported
See original GitHub issueWhen I call CommPortIdentifier.getPortIdentifier("COM2")
I get an error that unsigned Long pointer is not supported. I know the device is connected on COM2 because I can access it in YAT.
I’ve imported the library using gradle compile group: 'com.github.purejavacomm', name: 'purejavacomm', version: '1.0.2.RELEASE'
Stack trace:
java.lang.IllegalArgumentException: Invalid Structure field in class jtermios.windows.WinAPI$OVERLAPPED, field name 'Internal' (class jtermios.windows.WinAPI$ULONG_PTR): The type "jtermios.windows.WinAPI$ULONG_PTR" is not supported: Can't create an instance of class jtermios.windows.WinAPI$ULONG_PTR, requires a public no-arg constructor: java.lang.reflect.InvocationTargetException at com.sun.jna.Structure.validateField(Structure.java:1215) at com.sun.jna.Structure.validateFields(Structure.java:1224) at com.sun.jna.Structure.<init>(Structure.java:200) at com.sun.jna.Structure.<init>(Structure.java:193) at com.sun.jna.Structure.<init>(Structure.java:180) at com.sun.jna.Structure.<init>(Structure.java:172) at jtermios.windows.WinAPI$OVERLAPPED.<init>(WinAPI.java:459) at jtermios.windows.JTermiosImpl$Port.<init>(JTermiosImpl.java:65) at jtermios.windows.JTermiosImpl$Port.<init>(JTermiosImpl.java:53) at jtermios.windows.JTermiosImpl.open(JTermiosImpl.java:348) at jtermios.JTermios.open(JTermios.java:422) at purejavacomm.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:101) at com.<redacted>.network.SerialClient.SerialClient.connect(SerialClient.java:47) at com.<redacted>.network.NMEAConnection.NMEAConnection.connect(NMEAConnection.java:148) at com.<redacted>.nmea_device.Application.run(Application.java:93) at com.<redacted>.nmea_device.Application.main(Application.java:132) Caused by: java.lang.IllegalArgumentException: The type "jtermios.windows.WinAPI$ULONG_PTR" is not supported: Can't create an instance of class jtermios.windows.WinAPI$ULONG_PTR, requires a public no-arg constructor: java.lang.reflect.InvocationTargetException at com.sun.jna.Native.getNativeSize(Native.java:1362) at com.sun.jna.Structure.getNativeSize(Structure.java:2174) at com.sun.jna.Structure.getNativeSize(Structure.java:2164) at com.sun.jna.Structure.validateField(Structure.java:1211) ... 15 more
Any help is appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
I encountered the same problem(java.lang.IllegalArgumentException: The type “jtermios.windows.WinAPI$ULONG_PTR” is not supported) and found it is indeed a JNA version compatibility problem. After downgrading to JNA 4.2.2(previously 5.10.0), the problem is solved. Just FYI.
Thansk for the heads up!