简体   繁体   English

将jar文件导入jar文件中的另一个目录中

[英]Importing Jar files in another directory within your jar file

I have a Jar file that has the a few packages. 我有一个包含几个软件包的Jar文件。

I want to import the commons library and within Eclipse that's pretty simple. 我想导入commons库,并且在Eclipse中非常简单。

However when I export the jar file, and run it, it is not able to find the commons library and therefore unable to run. 但是,当我导出jar文件并运行它时,它找不到公用库,因此无法运行。 I want to know if I have to move the commons jar files to the exact same directory (within the package)? 我想知道是否必须将commons jar文件移动到完全相同的目录(在软件包内)? 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 我还想使此jar文件能够发送给人们并由任何人使用,而无需让他们修改其计算机上的任何内容

you need to include jars in your classpath if you are running on command line ( Here is an example of this ) 如果您在命令行上运行,则需要在类路径中包含jar( 这是此示例

if you want it to all be neatly wrapped in one jar consider looking at OneJar . 如果您希望将它们全部整齐地包装在一个罐子中,请考虑查看OneJar ( oneJar example ) or JarJar. 例如oneJar )或JarJar。

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

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