BridJ can't find the native library, no matter where it is

354 views
Skip to first unread message

Niko Vuokko

unread,
Feb 16, 2015, 6:34:22 AM2/16/15
to nativel...@googlegroups.com
Hiya,

I have a 64-bit DLL which was JNAerated into a BridJ Maven project and then made into a JAR. Then I have a Java project using this JAR as a Maven dependency, which I'm trying to run.

However, BridJ never finds the DLL. I've tried using a slim or the fat shaded JAR (with DLL under <jar>/lib/win64/), I've tried separately placing the DLL to ./, lib/win64/, src/main/resources/lib/win64 and some others as well, I've tried setting java.library.path to all these. These paths do show up in the BridJ logs with -Dbridj.debug  -Dbridj.veryVerbose and -Dbridj.logCalls, but the error remains. The DLL is 64-bit, Java is 64-bit, the DLL has no non-system dependencies.

Initially, before trying all these alternatives, the DLL at least showed up in AppData/Local/Temp/.../ along with bridj.dll, but now it doesn't anymore. Not sure why...

Any advice? I'm really out of ideas.


(Not sure if it's normal, the final log says:)

INFO: Library not found : LASlib
java.lang.NullPointerException
    at java.io.File.<init>(File.java:277)
    at org.bridj.BridJ.getNativeLibraryPaths(BridJ.java:737)
    at org.bridj.BridJ.findNativeLibraryFile(BridJ.java:906)
    at org.bridj.BridJ.getNativeLibraryFile(BridJ.java:850)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:1042)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:608)
    at org.bridj.CRuntime.getNativeLibrary(CRuntime.java:488)
    at org.bridj.CRuntime.register(CRuntime.java:385)
    at org.bridj.CRuntime.register(CRuntime.java:345)
    at org.bridj.BridJ.register(BridJ.java:364)
    at org.bridj.BridJ.register(BridJ.java:204)
    at org.lastools.LasFileReader.<clinit>(LasFileReader.java:24)
    at Tst.main(Tst.java:7)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

helmikuuta 16, 2015 1:23:31 IP. org.bridj.BridJ log
INFO: Loaded library 'LASlib' from 'null'

hải anh trương

unread,
Jun 23, 2018, 7:38:15 AM6/23/18
to NativeLibs4Java
You should try
                System.setProperty("java.library.path", path);
        BridJ.addLibraryPath(path);
        BridJ.getNativeLibrary(libraryName);

Vào 18:34:22 UTC+7 Thứ Hai, ngày 16 tháng 2 năm 2015, Niko Vuokko đã viết:
Reply all
Reply to author
Forward
0 new messages