更新时间:2023-11-18 15:32:46
的 -cp
(和 -classpath
)论点的忽略当使用 -jar
参数。您需要在JAR的 MANIFEST.MF
文件中的类路径
属性来指定的。
The -cp
(and -classpath
) arguments are ignored when using -jar
argument. You need to specify it in the Class-Path
attribute of JAR's MANIFEST.MF
file.
我的蚂蚁是一种有点生疏,但它的东西就像那些行:
My ant is a bit rusty, but it's something like those lines:
<attribute name="Class-Path" value="${dist.classpath}"/>
更新您想按你的意见,知道如何直接使用Eclipse,而不是用Ant hassling做到这一点。首先,您需要使用控制骨节病> + F11 骨节病>运行提出的的main()
方法,然后单击鼠标右键项目,选择导出>运行的JAR文件的(注意可运行的部分,这是很重要的!)。然后,在向导,你必须从列表中选择相同的启动配置的(如果必要,选择库操作),然后单击的完成的。通过这种方式生成清单
文件时,Eclipse将采取构建路径的详细信息自动地考虑进去。
Update as per your comments you'd like to know how to do this directly with Eclipse instead of hassling with Ant. First, you need to run the proposed main()
method using Ctrl+F11 and then rightclick the project, choose Export > Runnable JAR file (note "Runnable" part, this is important!). Then, in the Wizard you have to choose the same Launch configuration from the list (and if necessary choose library handling) and then click Finish. This way Eclipse will take the buildpath details automagically into account when generating the MANIFEST
file.