0

I would create a jar of only one package belonged to my project. this package contains a main class.how can I do?

4

1 回答 1

1

From the 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.

So you could just specify your path as a package:

jar cf <jar file name> com/companyname/package/ 
于 2012-07-14T12:11:28.443 回答