Reputation: 69249
I am trying to use DLL's from a specific place from the disk (because I am using JNotify library).
Using Netbeans 7.4, the following happened:
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/
. Program outputs: 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.
When I run it as java -jar <jarfile>
: It gives me my %PATH%
variable.
When I run it as java -jar <jarfile> -Djava.library.path=D:/JNotify-dll/
it still gives me my %PATH%
variable.
Does anyone have any clue what is going on? I am getting real tired of it.
The MANIFEST.MF
generated by Netbeans:
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.
Upvotes: 3
Views: 20669
Reputation: 17867
You need to change the order of your command line arguments:
java -Djava.library.path=D:/JNotify-dll/ -jar <jarfile>
See also:
Upvotes: 15