Jar包的Source在“C:/Src/AppTest/”下
如果我把批处理命令CreateJar.cmd放在“C:/Src/AppTest/”下:
CreateJar.cmd命令里写“jar cvf AppTest.jar *” 即可
但是由于有很多个Jar包需要编译,所以不能写成固定的路径。
需要把批处理命令CreateJar.cmd 放在“C:/Src/”下,该如何写Jar命令,才能生成该Jar包
---偶Dos太菜了,汗一下,先
------解决方案--------------------
关注。。。楼主的问题我也碰到过,一直没有解决。
后来选了另外一种方式
利用ant编译和打包,现在用用也有1年多了感觉还比较好用。
<project name= "cardsystem-project " basedir= ". " default= "jar ">
<property name= "src " value= "src "/>
<property name= "lib " value= "lib "/>
<property name= "build " value= "build "/>
<path id= "classpath ">
<fileset dir= "${lib} ">
<include name= "**/*.jar "/>
</fileset>
</path>
<!-- 编译 -->
<target name= "compile " depends= " ">
<!-- Compile the java code from ${src} into ${build} -->
<javac source= "1.6 " srcdir= "${src} " destdir= "${build} " classpathref= "classpath " />
</target>
<!-- 打包 -->
<target name= "jar " depends= "compile ">
<jar destfile= "./cardsystem.jar " basedir= "${build} " >
<manifest>
<attribute name= "Built-By " value= "xxx "/>
<attribute name= "Company " value= "xxx "/>
<attribute name= "Main-class " value= "MainFrame "/>
</manifest>
<zipfileset src= "${lib}/dom4j-1.6.1.jar "/>
<zipfileset src= "${lib}/log4j-1.2.14.jar "/>
<zipfileset src= "${lib}/commons-logging-1.1.jar "/>
<zipfileset src= "${lib}/commons-logging-adapters-1.1.jar "/>
</jar>
</target>
</project>
------解决方案--------------------
jar -cvf AppTest.jar -C AppTest/*