StrikerX3/JXInput

Issue with Library

Ddg3 opened this issue · 6 comments

Ddg3 commented

When using the following try catch block I get this error:

try
{
device = XInputDevice.getDeviceFor(0);
}
catch (XInputNotLoadedException e)
{
}

Exception in thread "main" java.lang.UnsatisfiedLinkError: edu.digipen.zacharylawrence.xinput.natives.XInputNatives.getLoadedLibVersion()I
at edu.digipen.zacharylawrence.xinput.natives.XInputNatives.getLoadedLibVersion(Native Method)
at edu.digipen.zacharylawrence.xinput.XInputDevice.(XInputDevice.java:55)

At this line in XInputDevice: LIBRARY_VERSION = XInputLibraryVersion.values()[XInputNatives.getLoadedLibVersion()];

I assume I am missing some files in my path. Can anyone give some insight into this?

I assume that you have copied the classes to your project as opposed to referencing the jar in your source code.
JXInput's jar includes the DLLs to access XInput as resources (see the src/main/resources folder). These folders and files must be present in the classpath for JXInput to work. The recommended way to use JXInput is to build it with Maven and include the jar in the classpath.

Ddg3 commented

Yes, I did copy the classes into my project. I hate to ask this, but is it possible that I could get a copy of the already built files? I do not know how to use maven and nor do my colleagues. We need the files for a project that is on a deadline.

I can do that when I get back home, in about 4 hours. I should probably publish releases on GitHub too, since more people have had issues with the embedded native libraries before.

Grab the jar from the release and add it to your classpath: https://github.com/StrikerX3/JXInput/releases/tag/v0.8
Make sure to use the original package names (com.ivan.xinput).

I am closing this issue. If you still can't get it to work, reopen this issue.

Hi, I'm having the same issue. I 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 copied the classes directly into the project. Please help!