如何设置java库路径进行处理

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1734207/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 22:01:35  来源:igfitidea点击:

how to set java library path for processing

javajava-native-interface

提问by Haiyuan Zhang

I'm using PDE to run a Processing sketch, and I get the following error:

我正在使用 PDE 运行处理草图,但出现以下错误:

Verify that the java.library.pathproperty is correctly set.

验证是否java.library.path正确设置了该属性。

Could anyone of you tell me how to solve this problem?

你们中的任何人都可以告诉我如何解决这个问题吗?

采纳答案by Brian Agnew

You can set it on the command line thus:

您可以在命令行上设置它,因此:

java -Djava.library.path=...

and point it to the directorycontaining the relevant library.

并将其指向包含相关库的目录

回答by David Vandergucht

In Eclipse, I did this to get OpenCV working:

在 Eclipse 中,我这样做是为了让 OpenCV 工作:

  1. In the Runmenu, select Run Configuration.
  2. Go to the (x)=Argumentstab of your sketch.
  3. Add this in the VM argumentsfield:

    -Djava.library.path="/path/to/OpenCV/library"
    
  1. 运行菜单中,选择运行配置
  2. 转到草图的(x)=Arguments选项卡。
  3. VM 参数字段中添加以下内容:

    -Djava.library.path="/path/to/OpenCV/library"
    

回答by caopeng

Before System.loadLibrary(""), use the following code to check you java.library.path

之前System.loadLibrary(""),使用下面的代码来检查你java.library.path

System.out.println(System.getProperty("java.library.path"));

System.out.println(System.getProperty("java.library.path"));

Generally,the java.library.path=/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib

一般来说,java.library.path= /usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib

Provides several options for:

提供了几个选项:

  • $ sudo cp libxxx.so /usr/lib/jni
  • java -Djava.library.path=path of soxxx
  • $ sudo cp libxxx.so /usr/lib/jni
  • java -Djava.library.path= soxxx 的路径

回答by user3048370

Your library.pathis fine, what you need to do is to drop prefix liband suffix .sofrom your System.loadLibrary( "..." ). On Linux or "linux-android" those will be automatically added by JVM.

library.path是好的,你需要做的是下降的前缀lib和后缀.soSystem.loadLibrary( "..." )。在 Linux 或“linux-android”上,JVM 会自动添加这些内容。