Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

UnsatisfiedLinkError on release jar #37

Closed
wodxgod opened this issue Apr 2, 2019 · 7 comments
Closed

UnsatisfiedLinkError on release jar #37

wodxgod opened this issue Apr 2, 2019 · 7 comments

Comments

@wodxgod
Copy link

wodxgod commented Apr 2, 2019

I've downloaded and imported the library to my project (from the "Releases" page), and for some reason, whenever I run my code, it spits out a stacktrace error (UnsatisfiedLinkedError) that it can't load the library.

Java SDK version: 1.8.0_191
Images of the code, stacktrace errors etc.: https://imgur.com/a/9WgX5fq

@MinnDevelopment
Copy link
Owner

Are you using one of the supported platforms? What is the exact error with stacktrace? Which jar did you use?

@MinnDevelopment MinnDevelopment changed the title Couldn UnsatisfiedLinkError on release jar Apr 2, 2019
@wodxgod
Copy link
Author

wodxgod commented Apr 2, 2019

Are you using one of the supported platforms? What is the exact error with stacktrace? Which jar did you use?

I'm on Windows 10 and I used the "java-discord-rpc-2.0.1-all" jar file

@MinnDevelopment
Copy link
Owner

MinnDevelopment commented Apr 2, 2019

I just tested this with a completely bare project on windows 10:

C:\Users\minnced\test>run.bat
=== Test.java ===
import java.io.*;
import club.minnced.discord.rpc.*;

class Test {
    public static void main(String[] args) throws InterruptedException {
        DiscordRPC lib = DiscordRPC.INSTANCE;
        lib.Discord_Initialize("420321485757087746", null, true, null);
        DiscordRichPresence presence = new DiscordRichPresence();
        presence.details = "Testing RPC";
        lib.Discord_UpdatePresence(presence);

        System.out.println("RichPresence is working as intended");
        Thread.sleep(30000);
        System.out.println("Finished!");
    }
}
=== manifest.mf ===
Main-Class: Test
Class-Path: rpc.jar
Maniest-Version: 1.0
===================

C:\Users\minnced\test>javac -cp rpc.jar Test.java

C:\Users\minnced\test>jar -c -m manifest.mf -f test.jar Test.class

C:\Users\minnced\test>java -jar test.jar
RichPresence is working as intended
Finished!

Since a bare project works fine, I assume this is an issue with setup. Try using gradle instead which is a proper build tool rather than the built-in IDE artifact builder. The README explains how to add this as a gradle dependency. See Gradle Guides and java-discord-rpc as gradle dependency

@MinnDevelopment
Copy link
Owner

I'm assuming this was resolved since there hasn't been a response in over a week.

@wodxgod
Copy link
Author

wodxgod commented Apr 11, 2019

I'm assuming this was resolved since there hasn't been a response in over a week.

Sadly not. I've not been able to fix the problem

@belohnung
Copy link

belohnung commented Apr 16, 2019

same problem but on linux

@MinnDevelopment
Copy link
Owner

Same answer but for linux then. Use gradle and make sure your setup works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants