java - Can't load personal dll with jna from netbeans -


i'm using netbeans 7.4 / jdk 1.7u51

i downloaded jar jna official site, in version 4.0.0.

i have internally developped dll interface in plain c, loads ctypes in python. dll compiled in release visual 2010, runtime in path.

d:\fl006\downloads>dir d:\deploy\spotlight\spotlight-1488\pasanbuslibrary.dll  directory of d:\deploy\spotlight\spotlight-1488  29.01.2014  11:13         1'690'112 pasanbuslibrary.dll 

i tried load in java jna:

public interface clibrary extends library {      (...snip...)     void pasanipcinitializelibrary(string xclient, string xbusname, int xtimeout);     void pasanipcterminatelibrary(); }  public static void main(string[] args) {     nativelibrary.addsearchpath("pasanbuslibrary","d:\\deploy\\spotlight\\spotlight-1488");     clibrary bus = (clibrary) native.loadlibrary("pasanbuslibrary",clibrary.class); (... snip ...)     

this out of book standard dll load, custom location.

when activating jna debug, see following :

run: looking in classpath sun.misc.launcher$appclassloader@714a8f44 /com/sun/jna/win32-x86-64/jnidispatch.dll found library resource @ jar:file:/d:/code/perso/testwrapperbus/jna-4.0.0.jar!/com/sun/jna/win32-x86-64/jnidispatch.dll looking library 'pasanbuslibrary' adding paths jna.library.path: null trying d:\deploy\spotlight\spotlight-1488\pasanbuslibrary.dll adding system paths: [] trying d:\deploy\spotlight\spotlight-1488\pasanbuslibrary.dll looking lib- prefix trying libpasanbuslibrary.dll looking in classpath sun.misc.launcher$appclassloader@714a8f44 pasanbuslibrary exception in thread "main" java.lang.unsatisfiedlinkerror: unable load library 'pasanbuslibrary': native library (win32-x86-64/pasanbuslibrary.dll) not found in resource path ([file:/d:/code/perso/testwrapperbus/jna-4.0.0.jar, file:/d:/code/perso/testwrapperbus/jna-platform-4.0.0.jar, file:/d:/code/perso/testwrapperbus/build/classes/])     @ com.sun.jna.nativelibrary.loadlibrary(nativelibrary.java:271)     @ com.sun.jna.nativelibrary.getinstance(nativelibrary.java:398)     @ com.sun.jna.library$handler.<init>(library.java:147)     @ com.sun.jna.native.loadlibrary(native.java:412)     @ com.sun.jna.native.loadlibrary(native.java:391)     @ testwrapperbus.testwrapperbus.main(testwrapperbus.java:39) 

it looks looks through location gave , somehow discards it. tried different folders , got same behaviour, there no obvious file system right issue (dll rw users)

any clue on i'm missing, i'm kind of stuck currently...

edit

  • if load "msvcrt" working nice cll printf
  • my dll has dependencies, of them hosted in c:\windows\system32 (standard runtime, dynamically linked)

my dll win32 compilation while use win64 jdk / jre. of course, when dealing pure java, don't care loading native library needs match.

i tried running command line on 32 bits jre7 , worked, i'm pretty sure installing jdk win32 in netbeans or recompiling dll in 64 bits solve issue.

thanks answer : trying use dll java (jna). unable load library exception having put me on righteous path


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -