Loading JNI lib on Mac OS X?

后端 未结 3 606
独厮守ぢ
独厮守ぢ 2021-01-12 20:05

Background

So I am attempting to load a jnilib (specifically JOGL) into Java on Mac OS X at runtime. I have been following along the relevant Stack

相关标签:
3条回答
  • 2021-01-12 20:43

    Jogl always tries to auto-load all dependent libraries. To avoid this, there should be a NativeLibLoader class where you can call disableLoading() before you load the libraries yourself via the System.load()

    0 讨论(0)
  • 2021-01-12 20:44

    You don't have to provide the java.library.path at startup. You can programmatically set it with

    System.setProperty("java.library.path", "/var/folder/bla/foo/bar/");
    

    I don't know if System.load() will work somehow without this library path.

    0 讨论(0)
  • 2021-01-12 20:51

    System.load(...) takes libraryName as argument. It doesn't take path to library as argument. JVM searches for a library with specified name in the list of paths specified in -Djava.library.path;

    Here there is nothing specific to Mac OS X. It searches for libraries in the same way on all operating systems.

    0 讨论(0)
提交回复
热议问题