如何将本机库添加到“java.library.path”使用Eclipse启动(而不是覆盖它) [英] How to add native library to "java.library.path" with Eclipse launch (instead of overriding it)
问题描述
我有一个本地库需要添加到 java.library.path 。使用JVM参数 -Djava.library.path = path ... 我可以根据需要设置路径。
I got a native library that needs to be added to java.library.path. With JVM argument -Djava.library.path=path... I can set the path as I want.
我的问题是我的其他库(pentaho报告)基于默认java.library.path(包括系统目录等)搜索字体,手动设置覆盖默认路径。
My problem is that my other library (pentaho reporting) searches fonts based on the default java.library.path (including system directories etc) and the manual setting overrides the default path..
所以:我如何将添加到默认java.library.path的路径条目,而不是覆盖它(这似乎是用-Djava.library.path完成的)? (我不想手动添加默认路径,为了部署起来不会很好)
So : how can I add a path entry to the default java.library.path instead of overriding it (which seems to be done with -Djava.library.path)? (I wouldn't want to add the default path by hand, which wouldn't be nice for the sake of deployment)
编辑:对于缺少的细节,很抱歉,我正在使用Eclipse。 (部署是使用JNLP完成的,我可以使用资源下的 nativelib )
Sorry for missing details; I'm working with Eclipse. (The deployment is done with JNLP and there I can use nativelib under resources)
推荐答案
已经忘记了这个问题...我实际上是在问Eclipse,对不起原来的说法。
答案似乎太简单了(至少有3.5;可能还有旧版本):
Had forgotten this issue... I was actually asking with Eclipse, sorry for not stating that originally. And the answer seems to be too simple (at least with 3.5; probably with older versions also):
Java运行配置的参数:VM参数: p>
Java run configuration's Arguments : VM arguments:
-Djava.library.path="${workspace_loc:project}\lib;${env_var:PATH}"
不要忘记引号,否则PATH中的空格有问题。
Must not forget the quotation marks, otherwise there are problems with spaces in PATH.
这篇关于如何将本机库添加到“java.library.path”使用Eclipse启动(而不是覆盖它)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!