如何使用外部jar构建可执行jar

如何使用外部jar构建可执行jar

本文介绍了Eclipse:如何使用外部jar构建可执行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.

有人可以提供一个关于如何包含外部jar的详尽指南程序使用eclipse?

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 04:25