Command-line tool 'jar' is not reading directories
I'm running jar
in order to create a JAR file with the command:
jar cmf manifest.txt generatedParser generator gui resource
generatedParser
, generator
, gui
, and resource
are directories, but jar
doesn't re开发者_运维百科ad them, complaining that:
java.io.FileNotFoundException: generatedParser (Is a directory)
But I was under the impression that jar
would recursively read directories and according to the example in Creating a JAR File, the directories audio and images were read just fine. So why doesn't it work, what am I missing? I want to generate a JAR application that contains the packages generatedParser
, generator
, gui
and resource
. They are normal uncompressed directories that contain class files.
The f
flag indicates the presence of the jar file name following the manifest file name on the command line. The correct command line would be
jar cmf manifest.txt myJarName.jar generatedParser generator gui resource
The error message is the result of jar
trying to use the directory generatedParser
as the jar file -- it doesn't work out very well, as you can see.
精彩评论