在NetBeans IDE中创建一个项目的唯一一个包的jar文件

问题描述:

我会创建一个jar包,只包含属于我的项目的一个包。这个软件包包含一个主要类,我可以做什么?在NetBeans IDE中创建一个项目的唯一一个包的jar文件

+0

呃,用'jar'命令? – 2012-07-14 11:48:14

+0

你想让jar运行吗? – plasma147 2012-07-14 11:55:30

+0

是的,我会罐子运行。我的意思是我有一个项目与许多包。我会创建只有一个包含主包的jar。 – Mazzy 2012-07-14 12:00:17

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/