How to set the java.library.path from Eclipse

后端 未结 16 2413
陌清茗
陌清茗 2020-11-22 05:36

How can I set the java.library.path for a whole Eclipse Project? I\'m using a Java library that relies on OS specific files and need to find a .dll/

相关标签:
16条回答
  • 2020-11-22 06:11

    Remember to include the native library folder in PATH.

    0 讨论(0)
  • 2020-11-22 06:11

    the easiest way would to use the eclipse IDE itself. Go to the menu and set build path. Make it point to the JAVA JDK and JRE file path in your directory. afterwards you can check the build path where compiled files are going to be set. in the bin folder by default though. The best thing would be to allow eclipse to handle itself the build path and only to edit it similar to the solution that is given above

    0 讨论(0)
  • 2020-11-22 06:12

    Don't mess with the library path! Eclipse builds it itself!

    Instead, go into the library settings for your projects and, for each jar/etc that requires a native library, expand it in the Libraries tab. In the tree view there, each library has items for source/javadoc and native library locations.

    Specifically: select Project, right click -> Properties / Java Build Path / Libraries tab, select a .jar, expand it, select Native library location, click Edit, folder chooser dialog will appear)

    Messing with the library path on the command line should be your last ditch effort, because you might break something that is already properly set by eclipse.

    Native library location

    0 讨论(0)
  • 2020-11-22 06:14

    I think there is another reason for wanting to set java.library.path. Subversion comes with many libraries and Eclipse won't see these unless java.library.path can be appended. For example I'm on OS-X, so the libraries are under \opt\subversion\lib. There are a lot of them and I'd like to keep them where they are (not copy them into a standard lib directory).

    Project settings won't fix this.

    0 讨论(0)
  • 2020-11-22 06:16

    Another solution would be to open the 'run configuration' and then in the 'Environment' tab, set the couple {Path,Value}.

    For instance to add a 'lib' directory located at the root of the project,

        Path  <-  ${workspace_loc:name_of_the_project}\lib
    
    0 讨论(0)
  • 2020-11-22 06:16

    You can add vm argument in your Eclipse.

    Example :

    -Djava.ext.dirs=cots_lib
    

    where cots_lib is your external folder library.

    0 讨论(0)
提交回复
热议问题