I'm trying to use JInput for my project, and the library needs some binaries for my application to run.
I've discovered that, the required binaries are inside the library. But still, I get an UnsatisfiedLinkError
when doing a gradle run
because it cannot find the library binaries.
So I guess I need to unpack the library .jar
before running the project? How do I use a library that has native binaries in it?
Here's my build.gradle
plugins {
id "java"
id "application"
}
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/net.java.jinput/jinput
compile group: 'net.java.jinput', name: 'jinput', version: '2.0.7'
}
EDIT: Here you can see the contents of the library
Yes, there is an additional step. I followed these instructions: Getting started with JInput
The JInput dependencies you are linking in gradle file only set up the API for what methods/classes can be accessed. The actual machine code for those is inside the dynamic link libraries...DLL, i.e. the binaries.
First you download the DLLs:JInput DLL download into a folder.
Then you link the path to this folder with either a command line argument (
-Djava.library.path= "C:/pathToLibrary"
or dynamically by calling the following method before your class requiring it is created.