简体   繁体   中英

Where is the java folder for libraries on linux

I need to find \\jre\\lib\\ext under the java folder to add libraries. And I am not sure how to find it

Use String extDir = System.getProperty("java.ext.dirs"); to get the extensions dir path as you want (more info about system properties can be found here ), set the path and write the jar files to that directory (be carefull to capture any IOException that could be raise in the writing process because this folders are usually write-protected or require root/admin privileges)

As quoted in the comments, this is something that should only be done in exceptional cases

As most comments say don't do so, the alternative.

Most applications have an app .jar and a lib folder in which all library jars reside. In the application jar there is a META-INF/MANIFEST.MF with a class path including the lib jars.

As a developer I use maven (like ant, ivy) for the build infra structure and it does it just so. The jars are taken from the local maven repository else from the remote ones. Also maven uses a local repository of all jars in different versions. Jars missing in the remote repositories, like own programming, can be installed there.

BTW /usr/lib/jvm/ contains the java versions (do which java , which javac ).

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