问题描述
如何为整个Eclipse项目设置java.library.path?我使用的Java库依赖于操作系统特定的文件,并需要找到一个.dll / .so / .jnilib。但应用程序总是退出并显示一个错误消息,那些文件在库路径上找不到。
How can I set the java.library.path for a whole Eclipse Project? I'm using a Java library that relies on OS specific files and need to find a .dll/.so/.jnilib. But the Application always exits with an error message that those files are not found on the library path.
我想将整个项目配置为使用库路径。我试图将路径作为VM参数添加到eclipse中的一些运行配置,但是没有工作。
I would like to configure this whole project to use the library path. I tried to add the path as a VM argument to some run configurations in eclipse but that didn't work.
推荐答案
t乱的图书馆路径!
Don't mess with the library path! Eclipse builds it itself!
而是进入你的项目的库设置,对于需要本地库的每个jar / etc,在库选项卡。在树视图中,每个库都有源/ javadoc和本机库位置的项目。
Instead, go into the library settings for your projects and, for each jar/etc that requires a native library, expand it in the Libraries tab. In the tree view there, each library has items for source/javadoc and native library locations.
具体来说:选择 Project
,右键 - > 属性 / Java构建路径 / 选项卡,选择一个.jar,展开它,选择 ,会出现文件夹选择器对话框)
Specifically: select Project
, right click -> Properties / Java Build Path / Libraries tab, select a .jar, expand it, select Native library location, click Edit, folder chooser dialog will appear)
在命令行上使用库路径进行调试应该是您最后一次因为你可能会破坏已经由eclipse正确设置的东西。
Messing with the library path on the command line should be your last ditch effort, because you might break something that is already properly set by eclipse.
这篇关于如何设置java.library.path从Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!