1

I have a directory in which I generated *.class files. How can I build executable jar file from this files.

What I need to know is

  • how to clean dir
  • how to put all files in jar and make it executable

Sorry people i didnt mentioned, i need do this programmatically in java code.

4

2 回答 2

2
java cfe myJar.jar Classname.class myClass

并执行

java -jar Jarname.jar

创建一个罐子

于 2013-09-12T11:56:30.447 回答
2

如果您使用的是 Eclipse 或 Netbeans 之类的 IDE,则有一些特定的更简单的方法可以做到这一点。如果不是,我认为以下命令会起作用: jar cfe <jar-file> <main-class-name> <class-files...>

于 2013-09-12T11:58:25.213 回答