Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.UnsatisfiedLinkError: Method inside dll is not accessible

I am trying to access the function available inside the .dll file. But it give exception like "Exception in thread "main" java.lang.UnsatisfiedLinkError: *.jniGetAudioInputLevel()D". DLL file is loaded but when I try to access the methods it give an error message.

According to my knowledge:-

  • This exception only occurs if the .dll is not in the class path or the dll is not present in the jar file.
  • .dll file is only created if all the code is running with out any error.
  • I have seen the methods in the dll using tools like for example: Anywhere PE Viewer, PE Explorer etc. They both are showing the methods available in the .dll file.

How this in accessibility to the function can be configured out by any other idea?

like image 443
user237515 Avatar asked Dec 30 '22 02:12

user237515


1 Answers

An UnsatisfiedLinkError is also thrown if the native counterpart to a method declared native can't be found. This can easily happen if the native code was not named with the full Java package name separated using '_'.

For example,

package com.mycompany.stuff;

public native void doSomething();

Requires that a native library (DLL, so, *SRVPGM, etc depending on your system) be found and loaded with System.loadLibrary(), which contains and exports a function named

com_mycompany_stuff_doSomething

If you are certain that the native library is being loaded, my guess is that the function is not correctly named, or is not exported.

like image 81
Lawrence Dol Avatar answered May 21 '23 18:05

Lawrence Dol