如何设置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
how to set java library path for processing
提问by Haiyuan Zhang
I'm using PDE to run a Processing sketch, and I get the following error:
我正在使用 PDE 运行处理草图,但出现以下错误:
Verify that the
java.library.path
property 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 工作:
- In the Runmenu, select Run Configuration.
- Go to the (x)=Argumentstab of your sketch.
Add this in the VM argumentsfield:
-Djava.library.path="/path/to/OpenCV/library"
- 在运行菜单中,选择运行配置。
- 转到草图的(x)=Arguments选项卡。
在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.path
is fine, what you need to do is to drop prefix lib
and suffix .so
from your System.loadLibrary( "..." )
. On Linux or "linux-android" those will be automatically added by JVM.
你library.path
是好的,你需要做的是下降的前缀lib
和后缀.so
从System.loadLibrary( "..." )
。在 Linux 或“linux-android”上,JVM 会自动添加这些内容。