[英]Jar and java.library.path
I am trying to use DLL's from a specific place from the disk (because I am using JNotify library). 我正在尝试从磁盘上的特定位置使用DLL(因为我正在使用JNotify库)。
Using Netbeans 7.4, the following happened: 使用Netbeans 7.4,发生了以下情况:
My temporary program only does: 我的临时程序只能:
System.out.println(System.getProperty("java.library.path"));
As VM options in Netbeans I have set: -Djava.library.path=D:/JNotify-dll/
. 作为Netbeans中的VM选项,我设置了: -Djava.library.path=D:/JNotify-dll/
。 Program outputs: D:/Jnotify-dll/
. 程序输出: D:/Jnotify-dll/
。
When I run it as normal java <jarfile>
: It gives main class not set, while I did set it in Netbeans options. 当我正常运行java <jarfile>
:它未设置主类,而我在Netbeans选项中进行了设置。
When I run it as java -jar <jarfile>
: It gives me my %PATH%
variable. 当我以java -jar <jarfile>
身份运行它时:它给了我%PATH%
变量。
When I run it as java -jar <jarfile> -Djava.library.path=D:/JNotify-dll/
it still gives me my %PATH%
variable. 当我以java -jar <jarfile> -Djava.library.path=D:/JNotify-dll/
身份运行它时,它仍然为我提供了%PATH%
变量。
Does anyone have any clue what is going on? 有人知道发生了什么吗? I am getting real tired of it. 我对此感到非常厌倦。
The MANIFEST.MF
generated by Netbeans: Netbeans生成的MANIFEST.MF
:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.1
Created-By: 1.7.0_25-b17 (Oracle Corporation)
Class-Path: lib/ORM.jar lib/mysql-connector-java-5.1.23-bin.jar lib/co
mmons-dbcp-1.4-javadoc.jar lib/commons-dbcp-1.4.jar lib/commons-pool-
1.6-javadoc.jar lib/commons-pool-1.6.jar lib/jnotify-0.94.jar
X-COMMENT: Main-Class will be added automatically by build
Main-Class: bf4.bf4logreader.BF4LogReader
EDIT: java -jar -Djava.library.path=D:/JNotify-dll/ <jarfile>
, but I'd still appreciate an answer. 编辑: java -jar -Djava.library.path=D:/JNotify-dll/ <jarfile>
,但我仍然希望得到一个答案。
You need to change the order of your command line arguments: 您需要更改命令行参数的顺序:
java -Djava.library.path=D:/JNotify-dll/ -jar <jarfile>
See also: 也可以看看:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.