我有 'test.jar' 。我想创建 'my.jar' 。我希望 my.jar 包含 test.jar
我的代码:
<target name="jar" >
<copy file="${conf.dir}/default.xml" todir="${build.classes}" />
<jar jarfile="${build.dir}/test.jar" basedir="${build.classes}">
<manifest>
</manifest>
</jar>
</target>
<target name="services-jar">
<jar jarfile="${build.dir}/my.jar">
<manifest>
<attribute name="Main-Class" value="mypackage.MyClass" />
<attribute name="Class-Path" value="${build.dir}/test.jar" />
</manifest>
</jar>
</target>
如果我运行 'my.jar' :java -jar my.jar
显示消息: Could not find or load main class mypackage.MyClass
我的MANIFEST.MF文件:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.4
Created-By: 1.7.0_17-b02 (Oracle Corporation)
Main-Class: mypackage.MyClass
Class-Path: ./build/test.jar
任何的想法?