Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有 dll 文件的外部库,我使用的是 netbeans 和 java。我想在我的 jar 文件中添加一个库路径,例如:“java -Djava.library.path="bin"”,我该怎么做?我必须添加相对路径,而且我必须添加它,因为它将是一个供用户使用的程序,我希望它根本不需要安装。
谢谢
您可以为 DLL 使用绝对路径。如果您知道应该从哪里加载库,则无需更改路径。
System.load("C:/my/path/to/dll/my.dll");
您需要指定完整的 JAR 路径:
java -Djava.library.path="bin/my.jar"