New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnsatisfiedLinkError #148
Comments
Hi, Did you attempt to compile from source? I suspect that you compiled the Java code but not the native C code. There are full instructions for compiling everything for all supported platforms in the Wiki. Let me know if you have any questions or that does not solve your issue. Best, |
I compiled using the JAR - I'll read the wiki. The problem is, is that it has worked for a lot of users but doesn't work for one. |
Hi there. All I did was add the JAR to my modules (IntelliJ) and compile the whole program. It works perfectly - yet only one user has this error. |
Ahh, so one of your users is having trouble, but it is working for you? So the Jar that I distribute contains the required binaries for all supported platforms and goes though a somewhat complicated procedure to automatically "lazy-load" the included binary code. (Take a look at the DefaultLibraryLocator code) The error you are seeing suggests that the loading process failed for what could be a number of reasons. Most commonly, the users that experience issues do not have write access to the location provided by the Java property
|
See if you cant get a complete stack trace, that may help identify what is happening. |
Hmm - I think #1 is the best option. What files are left over from JNativeHook when the application closes? Can you tell me how to actually fix it? What code to use? I literally don't understand. Cheers. |
Look in the |
Note, that the static block of code executes when the Jar is loaded into the JVM and before main(...) actually runs. |
If the library is successfully extracted, and you are still seeing that error, it could also be an ABI mismatch. |
Haha, I see - the temp files. How could I provide someone "access" to create a temp file? Also is there anyway I could make these files .deleteOnExit()? |
I use to do the |
Also, remember that you need to tell the GlobalScreen which locator to use with |
|
How would I do this automatically? https://gist.github.com/kingArchie/0947b2e8df5a75dcb6003742d24c9f3e |
Would that method work? Or how would I add my own file and make GlobalScreen use that lib.? |
Yes, that's pretty much exactly what you want. Just remember, you can only have 1 app instance running or you will have the same problem I did. You can just add something like this to that class:
|
http://prntscr.com/eagvc2 - this is the dll that is created. Is this right? It didn't delete on exit for some reason. |
that is the class... hmm probably because its still in use while the jvm is running ;( #WindowsProblems |
Delete it before you call super. Write a little bit of code that looks at the location for files with similar names. You can control the library prefix with |
Yeah. Thought so. Would this fix the problem that the person was having? Is it possible to create a batch file to deleteOnExit? |
I am not sure if it will fix the problem that user is having because I dont know exactly what is happening on their system. Is there a full stack trace? |
You could probably safely delete all libs that start with JNativeHook also, but only on windows. |
https://gyazo.com/2ff3c3f19bb00315c20b9fa287942a2d that is the stacktrace I was sent. I was thinking - if I unregister the nativehook before the shut down, could I then delete the files on exit? |
Windows is all my program will run on. |
|
Unregistering the running hook wont help. You really need a |
I stopped it posting to console. Alright. I understand, thank you for your time. |
No problem, I leave this open for a while. If you get some more info, just post back here. I would recommend keeping the log level at at least Warning so that you get some important messaging. I have tried to make the warnings and errors only come up in critical situations. If its getting to noisy, let me know. |
Alright, great. |
Alright, a little update... it may be possible. Try using a similar library locator:
Add a custom class loader:
Then do some magic:
I literally just pulled this out of my ass and haven't tested any of it, however, the approach should work for using the custom class loader to find the class and then deleting files on GC. |
I'll test this tonight! |
I assume the last bit I would do on a shutdown hook? Like... m = null etc.? |
Cannot resolve symbol T |
java.lang.NoSuchMethodException: org.jnativehook.GlobalScreen.registerHook(org.jnativehook.GlobalScreen) I tried changing registerHook to registerNativeHook - same thing. |
Hi there,
Why do I get this error?
The text was updated successfully, but these errors were encountered: