如何使用 Javacpp 预设二进制文件

How to use Javacpp presets binaries

我正在尝试使用 javacpp-presets 二进制文件从 Java 访问 librealsense 库。我该如何使用它们?在 github 页面上,它说除了 javacpp.jar 之外,将所有需要的 JAR 文件(opencv*.jar、ffmpeg*.jar 等)放在我的 [=] 中的某处就足够了22=]路径。

我已经 运行 下面的命令得到了这些结果:

$ javac -cp javacpp-presets-bin/javacpp.jar:javacpp-presets-bin/librealsense.jar TestConnection.java
$ java -jar javacpp-presets-bin/javacpp.jar TestConnection
Warning: Could not load platform properties for class TestConnection
$ java -cp javacpp-presets-bin/javacpp.jar:javacpp-presets-bin/librealsense.jar:. TestConnection
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniRealSense in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:804)
    at org.bytedeco.javacpp.Loader.load(Loader.java:613)
    at org.bytedeco.javacpp.Loader.load(Loader.java:530)
    at org.bytedeco.javacpp.RealSense.<clinit>(RealSense.java:10)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.bytedeco.javacpp.Loader.load(Loader.java:585)
    at org.bytedeco.javacpp.Loader.load(Loader.java:530)
    at org.bytedeco.javacpp.RealSense$context.<clinit>(RealSense.java:1566)
    at TestConnection.main(TestConnection.java:8)
Caused by: java.lang.UnsatisfiedLinkError: no realsense in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:804)
    at org.bytedeco.javacpp.Loader.load(Loader.java:604)
    ... 8 more

我的工作目录:

.
├── javacpp-bin
├── javacpp-presets-bin
├── TestConnection.class
└── TestConnection.java

感谢任何帮助。

我应该使用 librealsense-platform.jar

$ javac -cp javacpp-presets-bin/javacpp.jar:javacpp-presets-bin/librealsense-platform.jar TestConnection.java
$ java -jar javacpp-presets-bin/javacpp.jar TestConnection
$ java -cp javacpp-presets-bin/javacpp.jar:javacpp-presets-bin/librealsense-platform.jar:. TestConnection