Skip to content
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

java.lang.UnsatisfiedLinkError: Can't find dependent libraries #7

Closed
psyvern opened this issue Oct 9, 2020 · 6 comments
Closed

java.lang.UnsatisfiedLinkError: Can't find dependent libraries #7

psyvern opened this issue Oct 9, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@psyvern
Copy link

psyvern commented Oct 9, 2020

I downloaded the examples directory and imported the v0.3 jar through gradle. I ran the ActivityManager example and the program crashed with the following:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\____\AppData\Local\Temp\nativeutils7090437070900\discord_game_sdk_jni.dll: Can't find dependent libraries
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2407)
	at java.base/java.lang.Runtime.load0(Runtime.java:747)
	at java.base/java.lang.System.load(System.java:1857)
	at cz.adamh.utils.NativeUtils.loadLibraryFromJar(NativeUtils.java:109)
	at de.jcm.discordgamesdk.Core.init(Core.java:45)
	at examples.ActivityExample.main(ActivityExample.java:25)

I suspect this is happening because i'm missing a header file in my computer, but i don't know what file.

@JnCrMx
Copy link
Owner

JnCrMx commented Oct 9, 2020

Hmm... this exception is not because of a missing header file (you don't need header files for already compiled library).
It is probably caused by the Discord SDK library not loaded correctly.

  • Did you modify the example (besides adding a package declaration)?
  • Are you using a 64-bit system and which version of Windows are you using?

I also made a minimal working example (at least it works on my machine), I will attach it as a zip, so you might try to extract and run it. Maybe there is something wrong about your build.gradle, so please try it with mine.

DiscordSDKTest.zip

@psyvern
Copy link
Author

psyvern commented Oct 10, 2020

  • No, i only added the package declaration
  • I'm using a 64-bit Windows 10 2004 (build 19041.546)

I tried your example and it still gives the same result.
Also, i tried stopping right before the .dll is read, and both of the temporary directories are where they're supposed to be.
I also tried running the code with a new user, but it still throws an exception

@JnCrMx
Copy link
Owner

JnCrMx commented Oct 10, 2020

Ok, I will try to run it on a clean VM to see if I can replicate the error.

Which version of Java are you using?

@JnCrMx
Copy link
Owner

JnCrMx commented Oct 10, 2020

I think I figured out the issue.
The dll I made requires two additional libraries:
A debug library that is most likely caused by a mistake of mine and the other is vcruntime140d.dll (d stands for debug which is my mistake).

I will try to fix this issue as soon as possible.

@JnCrMx JnCrMx added the bug Something isn't working label Oct 10, 2020
@JnCrMx
Copy link
Owner

JnCrMx commented Oct 10, 2020

I've made a new release (0.3.1) which doesn't use Debug builds anymore and works on my VM.
I hope that it works on your machine too now ^^

And thank you a lot for reporting this issue. I wouldn't have noticed it by myself 👍

@psyvern
Copy link
Author

psyvern commented Oct 11, 2020

Yes, it is working now. Thank you!

@psyvern psyvern closed this as completed Oct 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants