Problem with exporting project with linked JAR in Eclipse
YKH000 opened this issue · 3 comments
Hi, I'm having the same issue.
I originally copied the files directly into my project, which was unable to run. I then read this thread and downloaded the v0.8 jar which works when running in Eclipse, but the exported runnable JAR fails with the following message:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.ivan.xinput.natives.NativeLibraryHelper (rsrc:./) to field java.lang.ClassLoader.sys_paths
WARNING: Please consider reporting this to the maintainers of com.ivan.xinput.natives.NativeLibraryHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in Application start method
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)...
//...error text omitted omitted...//
Caused by: java.lang.UnsatisfiedLinkError: com.ivan.xinput.natives.XInputNatives.getLoadedLibVersion()I
at com.ivan.xinput.natives.XInputNatives.getLoadedLibVersion(Native Method)
at com.ivan.xinput.XInputDevice.(XInputDevice.java:73)
at application.RaceMonitorV1Controller.initialize(RaceMonitorV1Controller.java:133)
... 22 more
It seems to be the same as when I tried copying my project files into the JXInput folder imported as a Maven project, then exported the whole thing as a runnable JAR. I'm not sure if this is the right place to post this sort of issue, but is there any way I can get the linked JAR to work? Thanks!
What JDK version are you using? This might be a new policy which will make it harder to load the library on newer versions.
Seems like there are a new set of restrictions on setAccessible
on Java 9+, which was used with a hack to load the native libraries. The hack is not needed with System.load(String)