在netbeans ide中只创建一个项目包的jar文件

时间:2012-07-14 11:44:51

标签: java jar

我会创建一个只属于我项目的一个包的jar。这个软件包包含一个主类。我可以做什么?

1 个答案:

答案 0 :(得分:1)

来自jar documentation

jar cf jar-file input-file(s)

...
* The input-file(s) argument is a space-separated list of one or more files that you want to include in your JAR file. 
The input-file(s) argument can contain the wildcard * symbol. If any of the "input-files" are directories, the contents of those directories are added to the JAR archive recursively.

所以你可以将你的路径指定为一个包:

jar cf <jar file name> com/companyname/package/