【jar】打包命令
jar cvf filename.jar a.class b.class
打包带package的
jar cvf test.jar foldname\*
打包可执行jar包
来个小例子试试看:
我们只有一个HelloWorld,如下:
public class HelloWorld { public static void main(String[] args) { System.out.println(args[0]); } }
javac HelloWorld.java
jar cvf hello.jar HelloWorld.class
jar包中多了MANIFEST.MF
Manifest-Version: 1.0
Created-By: 1.4.2 (Sun Microsystems Inc.)
修改之,第三行加入
Manifest-Version: 1.0
Created-By: 1.4.2 (Sun Microsystems Inc.)
Main-Class: HelloWorld
jar umf MANIFEST.MF hello.jar
java -jar hello.jar helloworld!
结果输出:helloworld!
困难是老天给我们提高的机会,坚定不移勇敢地去攻克,不要退缩,加油!
posted on 2014-08-18 17:32 天地一连线_孤鸿挂飘渺 阅读(236) 评论(0) 编辑 收藏 举报