如何将本机库添加到“java.library.path";使用 Eclipse 启动(而不是覆盖它) [英] How to add native library to "java.library.path" with Eclipse launch (instead of overriding it)

查看:41
本文介绍了如何将本机库添加到“java.library.path";使用 Eclipse 启动(而不是覆盖它)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要添加到 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 完成的,我可以在 resources 下使用 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 参数:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆