Eclipse:如何使用外部 jar 构建可执行 jar? [英] Eclipse: How to build an executable jar with external jar?
问题描述
我正在尝试构建一个依赖于下载的外部 jar 的可执行 jar 程序.在我的项目中,我将它们包含在构建路径中,并且可以在 eclipse 中运行和调试.
I am trying to build an executable jar program which depends on external jar downloaded. In my project, I included them in the build path and can be run and debug within eclipse.
当我尝试将其导出到 jar 时,我可以运行该程序,但是当我尝试按下包含来自外部 jar 的函数调用和类的按钮时却无法运行.我已经编辑了环境变量 (Windows XP) CLASSPATH 以包含所有外部 jar 的路径,但它不起作用.
When I tried to export it to a jar, I can run the program but I can't when I try to press a button which includes function calls and classes from the external jar. I have edited the environment variables (Windows XP) CLASSPATH to include paths of all the external jar, but it doesn't work.
需要注意的一点是,我在导出可执行 jar 时收到了编译警告,但没有显示有关警告的任何描述.
A point to note is that I got compile warnings while exporting my executable jar, but it doesn't show up any description about the warnings.
有人愿意提供有关如何使用 Eclipse 包含外部 jar 程序的详尽指南吗?
Would someone kindly provide a thorough guide on how to include an external jar program using eclipse?
推荐答案
Eclipse 3.5 有一个选项可以将所需的库打包到可运行的 jar 中.文件 -> 导出...选择可运行的 jar 并单击下一步.可运行的 jar 导出窗口有一个单选按钮,您可以在其中选择将所需的库打包到 jar 中.
Eclipse 3.5 has an option to package required libraries into the runnable jar. File -> Export... Choose runnable jar and click next. The runnable jar export window has a radio button where you can choose to package the required libraries into the jar.
这篇关于Eclipse:如何使用外部 jar 构建可执行 jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!