简体   繁体   中英

Importing Jar files in another directory within your jar file

I have a Jar file that has the a few packages.

I want to import the commons library and within Eclipse that's pretty simple.

However when I export the jar file, and run it, it is not able to find the commons library and therefore unable to run. I want to know if I have to move the commons jar files to the exact same directory (within the package)? Or if there is something I can add to the import lines to make it work?

I also want to make this jar file able to be sent to people and used by anyone without having to get them to modify anything on their computer

you need to include jars in your classpath if you are running on command line ( Here is an example of this )

if you want it to all be neatly wrapped in one jar consider looking at OneJar . ( oneJar example ) or JarJar.

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