简体   繁体   中英

Java Library Path in Eclipse - Add dll library to multiple jars at once?

I have used the accepted answer provided to the question "How to set the java.library.path from Eclipse?" for setting the library path for a specific jar.

In my case, I have about 10 third party jars and each jar depends on the same set of dlls, but I need to do this process for each jar. I can do this manually, but is there any way to do this for more than one jar at a time?

In your case, manually editing the project's .classpath file might gain you a bit of efficiency. When I set the location of a JAR's native library, the following entry is added to my .classpath file:

<classpathentry exported="true" kind="lib" path="path/to/library.jar" sourcepath="/path/to/src">
    <attributes>
        <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="path/to/native/library.dll"/>
    </attributes>
</classpathentry>

You might manually set up the first JAR (via the Eclipse UI), close Eclipse and copy/paste the generated classpath entries in .classpath with the appropriate modifications, and then restart Eclipse.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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