Closed fbongcam closed 4 months ago
Thank you for reporting this problem. I was able to reproduce it.
I will need to investigate it further as I don't understand yet under what circumstances and why it occurs.
From what I can tell so far, it seems to be related to the JDK. If I run it with the JDK installed through homebrew ("OpenJDK Runtime Environment Homebrew (build 21.0.1)") it fails. If I run it with the Zulu JDK ("OpenJDK Runtime Environment Zulu21.30+15-CA (build 21.0.1+12-LTS)", it works.
What is your output of "java -version"?
I see, I am using the homebrew version.
Output:
openjdk version "21.0.1" 2023-10-17 OpenJDK Runtime Environment Homebrew (build 21.0.1) OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing)
So for the moment, take any other JDK, either using brew:
brew install zulu
or:
brew install temurin
or download it directly from:
https://www.azul.com/downloads/#zulu
or:
https://openjdk.org/projects/jdk/21/
or:
https://adoptium.net/en-GB/temurin/releases/
And then make sure, it's actually used...
I did install the azul JDK and I can confirm it is working.
When I use OpenJDK from homebrew I get this warning as well in the beginning of the console output:
WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
So far the apps I've ran still work (except for the current using this library) but I noticed this warning was not apparent when I ran with azul version of JDK.
Don't know if that gives you any more indication to where the problem lies.
Thanks for temporary solution π
I have opened an issue in the homebrew/core project: https://github.com/Homebrew/homebrew-core/issues/158901
The new version 0.7.1 of this library should now be compatible with all JDK 21 builds.
The new version 0.7.1 of this library should now be compatible with all JDK 21 builds.
Tested and can confirm it's working with OpenJDK 21 from Homebrew on M1 π
Getting this error on M1 mac. Using same eclipse and SDK configuration on both an intel based mac and apple silicon.
Config differences
OpenJDK 21 VM args: --enable-preview --enable-native-access=net.codecrete.usb
Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1135) Caused by: java.lang.ExceptionInInitializerError at net.codecrete.usb@0.6.1/net.codecrete.usb.macos.gen.corefoundation.CoreFoundation.<clinit>(CoreFoundation.java:20) at net.codecrete.usb@0.6.1/net.codecrete.usb.macos.CoreFoundationHelper.createCFStringRef(CoreFoundationHelper.java:61) at net.codecrete.usb@0.6.1/net.codecrete.usb.macos.MacosUSBDeviceRegistry.<clinit>(MacosUSBDeviceRegistry.java:50) at net.codecrete.usb@0.6.1/net.codecrete.usb.USB.createInstance(USB.java:30) at net.codecrete.usb@0.6.1/net.codecrete.usb.USB.instance(USB.java:47) at net.codecrete.usb@0.6.1/net.codecrete.usb.USB.getAllDevices(USB.java:68) at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method) at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1160) at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:300) at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newMethodAccessor(MethodHandleAccessorFactory.java:71) at java.base/jdk.internal.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:159) at java.base/java.lang.reflect.Method.acquireMethodAccessor(Method.java:726) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at javafx.graphics@21/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464) at javafx.graphics@21/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ... 2 more Caused by: java.lang.IllegalArgumentException: Cannot open library: CoreFoundation.framework/CoreFoundation at java.base/java.lang.foreign.SymbolLookup.libraryLookup(SymbolLookup.java:277) at java.base/java.lang.foreign.SymbolLookup.libraryLookup(SymbolLookup.java:238) at net.codecrete.usb@0.6.1/net.codecrete.usb.macos.gen.corefoundation.RuntimeHelper.<clinit>(RuntimeHelper.java:26) ... 20 more