简体   繁体   English

java.library.path的目的

[英]Purpose of java.library.path

Perhaps this is a duplicate question, but I havn't found something by myself. 也许这是一个重复的问题,但我自己找不到什么。

Basically I have an understanding problem. 基本上我有一个理解问题。

I have an application which works fine when I call it as follows: 我有一个应用程序,当我调用它时如下工作正常:

java -Duser.dir="some path" -Djava.library.path="pathToDLL1;pathToDLL2;pathToMyDir" classToCall par1

With the call above my application will start and run. 通过上面的调用,我的应用程序将启动并运行。

My problem in understanding is within the pathToMyDir directory (the content of this directory is mainly some needed dll's). 我理解的问题是在pathToMyDir目录内(这个目录的内容主要是一些需要的dll)。

When I start the same application with following command it will fail. 当我使用以下命令启动相同的应用程序时,它将失败。

java -Duser.dir="some path" -Djava.library.path="pathToMyDir;pathToDLL1;pathToDLL2" classToCall par1

I'm not sure if this is because of some dependencies, but I thought the java.library.path is mainly used to tell java where to look for external libraries. 我不确定这是不是因为某些依赖,但我认为java.library.path主要用于告诉java在哪里寻找外部库。 Or is this wrong? 或者这是错的? Is there also some order information hidden? 是否还隐藏了一些订单信息?

-Djava.library.path is used for pointing to native system libraries (dll or so files). -Djava.library.path用于指向本机系统库(dll或so文件)。 It points to a directory and calls to native code that use System.loadLibrary look in that directory for the native libs. 它指向一个目录并调用本机代码,该代码使用System.loadLibrary查找该目录中的本机库。

The project dependencies (jar files) should be specified on the application's classpath, not in this location. 应在应用程序的类路径中指定项目依赖项(jar文件),而不是在此位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM