Open srilakshmikanthanp opened 2 years ago
See the thread on stackoverflow for more info about the error and temporary fix.
You need to implement your own com.github.kwhat.jnativehook.NativeLibraryLocator
for most situations. I've implemented the com.github.kwhat.jnativehook.DefaultLibraryLocator
as a convince, but it doesn't work in all situations which is why NativeLibraryLocator
exists. In your particular situation, the solution outlined on stackoverflow is the correct answer. I am probably just going to remove the NativeLibraryLocator
functionality entirely and assume a developer using this library should understand what the java.library.path
property is and how to use it.
If you want me to look into this further, please provide a project (preferably Jetbrains Idea) where I can duplicate this issue.
You can find the actual project that produces the error in github. Could you give docs about how to implement com.github.kwhat.jnativehook.NativeLibraryLocator
?
Fixed with the following code
package com.github.srilakshmikanthanp.facsimile.locator;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import com.github.kwhat.jnativehook.NativeLibraryLocator;
import com.github.kwhat.jnativehook.NativeSystem;
/**
* This class is used to locate the native libraries.
*/
public class JLibLocator implements NativeLibraryLocator {
/**
* This method is used to regsiter the Locator.
*/
public static void setAaDefaultLocator() {
System.setProperty("jnativehook.lib.locator", JLibLocator.class.getCanonicalName());
}
/**
* Locates the native libraries.
*/
@Override
public Iterator<File> getLibraries() {
var libs = new ArrayList<File>(1);
var os = NativeSystem.getFamily().toString().toLowerCase();
var arch = NativeSystem.getArchitecture().toString().toLowerCase();
var jhome = System.getProperty("java.home");
var libName = System.mapLibraryName("JNativeHook");
var lib = jhome + File.separator + os + File.separator + arch + File.separator + libName;
var libFile = new File(lib);
libs.add(libFile);
return libs.iterator();
}
}
And make sure that you manually copied the dill files so image folder looks like
├───bin
│ └───server
├───conf
│ └───security
│ └───policy
│ ├───limited
│ └───unlimited
├───darwin
│ ├───arm64
│ └───x86_64
├───include
│ └───win32
├───legal
│ ├───java.base
│ ├───java.datatransfer
│ ├───java.desktop
│ ├───java.logging
│ ├───java.prefs
│ ├───java.xml
│ └───jdk.unsupported
├───lib
│ └───security
├───linux
│ ├───arm
│ ├───arm64
│ ├───x86
│ └───x86_64
└───windows
├───arm
├───x86
└───x86_64
can we close this issue ?
Hello i am using this library with javafx running with
mvn javafx:run
works fine but withmvn javafx:jlink
fails to start with a launcher, here is javafx plugin xml,and Here is stake trace,