2

When a make a simple test program with Logitech's LED SDK and run it, I get an UnsatisfiedLinkError with the message:

C:\Users\cwa38\AppData\Local\Temp\LogitechLedJNI.dll4587977834410494064: Can't find dependent libraries

What I have done so far:

  1. I downloaded the SDK from https://www.logitechg.com/en-us/innovation/developer-lab.html
  2. I extracted it
  3. I made a new Java project in NetBeans
  4. I added the logiled.jar file to my new project as a dependency
  5. I made a new class and copied the simple test program from the documentation (code is below)
  6. I clicked "run" and got the UnsatisfiedLinkError described above

I see that the SDK download comes with some .dll files and a .lib file, but I have no idea what to do with these files. The included documentation makes absolutely no mention of them.

What am I doing wrong?

Here is my code:

import com.logitech.gaming.LogiLED;

public class Main {
    public static void main(String[] args) {
        LogiLED.LogiLedInit();
        LogiLED.LogiLedSetLighting(100, 0, 0);
        LogiLED.LogiLedShutdown();
    }
}

And here is the full documentation from Logitech (yes, it really is this short):

The following steps show how to make the Logitech SDK work with a Java program. Please adapt the steps to your game for things to work.

Steps

  1. Copy the SDK’s Lib\logiled.jar to your project’s directory.
  2. Configure your project’s Java Build Path to include the logiled.jar.
  3. Call the functions from the JNI wrapper in your Java code as follows:
    import com.logitech.gaming.LogiLED;

    LogiLED.LogiLedInit();
    LogiLED.LogiLedSetLighting(red,blue,green);
    LogiLED.LogiLedShutdown();
  1. Compile and run your program.

The full stack trace for the error I get is below:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\cwa38\AppData\Local\Temp\LogitechLedJNI.dll4587977834410494064: 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:384)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
    at java.base/java.lang.Runtime.load0(Runtime.java:755)
    at java.base/java.lang.System.load(System.java:1953)
    at com.logitech.gaming.LogiLED.<clinit>(LogiLED.java:205)
    at javaapplication1.JavaApplication1.main(JavaApplication1.java:20)
C:\Users\cwa38\AppData\Local\NetBeans\Cache\12.4\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\cwa38\AppData\Local\NetBeans\Cache\12.4\executor-snippets\run.xml:68: Java returned: 1
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Charlie Armstrong
  • 2,332
  • 3
  • 13
  • 25
  • you should put those dll and lib files into same location with that jar, if you create a github repo with reproducer it will be easier to solve this. – ozkanpakdil Sep 12 '21 at 17:33
  • @özkanpakdil Thank you for the response. I tried putting the dll and lib files in the same folder as the jar, but still got the same error message. [Here](https://github.com/Chickencharm/KeyColors) is the project directory I am left with when I follow the exact steps described in my question. – Charlie Armstrong Sep 14 '21 at 04:57
  • can you check https://stackoverflow.com/a/12132922/175554 I do not think you can install 32 bit anymore but worth to check, another approach https://stackoverflow.com/a/67369117/175554 you may have some wrong dll. and last but not least do you have some virus scanner, that may affect jvm, try to disable and test. – ozkanpakdil Sep 20 '21 at 16:48
  • The native library (DLL) name and location is different for LGS and GHub. This might be a problem. – Egor Skriptunoff Oct 28 '21 at 17:46
  • @EgorSkriptunoff I have been using GHub so far. I will try using LGS and see if that changes anything. – Charlie Armstrong Oct 28 '21 at 18:04

2 Answers2

0

I tried to run your project in my netbeans but failed with

 project com.cwa380:KeyColors:jar:1.0: logitech:gaming:jar:9.00 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced

then I created a new project from ant, as long as you are using this logitech jar which is not really in maven repository, you dont need to have maven project.

netbeans create ant project

then I added the logiled.jar as image below project properties->libraries

good news when I run the code I get no exception. output below

execute output at the bottom

and when I try to use code completion netbeans lists the functions nicely.

logiled functions

here are my versions of tools

Product Version: Apache NetBeans IDE 12.4
Java: 17; OpenJDK 64-Bit Server VM 17+35-2724
Runtime: OpenJDK Runtime Environment 17+35-2724
System: Windows 10 version 10.0 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\ozkan\AppData\Roaming\NetBeans\12.4
Cache directory: C:\Users\ozkan\AppData\Local\NetBeans\Cache\12.4

in github I found https://github.com/larsgrefer/logi-led you may contact with Lars(@larsgrefer), looks like he knows how to use logitech SDK.

here is my project https://github.com/ozkanpakdil/spring-examples/tree/master/JavaApplication1 make sure you have added logiled jar in correct path to libraries

ozkanpakdil
  • 3,199
  • 31
  • 48
  • I followed these exact steps and still ended up with the exact same UnsatisfiedLinkError described in the question. The Netbeans peoject I was left with is [here](https://github.com/Chickencharm/KeyColorsAnt). – Charlie Armstrong Sep 16 '21 at 02:21
  • probably we are not using same versions then, I added jdk netbeans version to my answer. – ozkanpakdil Sep 16 '21 at 10:21
  • I have been using Netbeans 12.4 with JDK 16 on Windows 10. I just updated to JDK 17, so we are now using the exact same setup, and I still get the error. – Charlie Armstrong Sep 17 '21 at 02:21
  • I added my netbeans project in a repo, if you are still getting UnsatisfiedLinkError, means you did not have logiled jar in correct path, can you update your question and add full stack trace ? – ozkanpakdil Sep 17 '21 at 17:46
  • I just downloaded your repo and ran it, I still get the error. I put the full stack trace in my question. – Charlie Armstrong Sep 19 '21 at 22:25
0
  1. I added the logiled.jar file to my new project as a dependency

Need to add x64 version, not x86.

\Lib\JNI\x64\logiled.jar

should work.

ekqeos
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 30 '23 at 13:48