This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Any idea what is wrong with this manifest file please? I'm using WinXP command line. The first line is stated to be the minimum legal manifest by Horstmann and Cornell.
Manifest-Version: 1.0
Name:FileChooserTest.class
Loads a JFileChooser
Command line
>jar cfm FileChooser.jar JFileChooser.mf *.class
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:393)
at java.util.jar.Manifest.read(Manifest.java:182)
at java.util.jar.Manifest.<init>(Manifest.java:52)
at sun.tools.jar.Main.run(Main.java:132)
at sun.tools.jar.Main.main(Main.java:1022)
>
>
>type *.mf
JFileChooser.mf
Manifest-version: 1.0
Name:FileChooserTest.class
Loads a JFileChooser
>jar cfm FileChooser.jar JFileChooser.mf *.class
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:393)
at java.util.jar.Manifest.read(Manifest.java:182)
at java.util.jar.Manifest.<init>(Manifest.java:52)
at sun.tools.jar.Main.run(Main.java:132)
at sun.tools.jar.Main.main(Main.java:1022)
You specify the entry point of the program (the main class) with a Main-Class attribute (not a Name attribute). I'm not sure if Name is a valid attribute in a manifest file.
Also, put a space between the : and the value of the attribute. Make sure that the manifest ends with an empty line; there's a known problem where Java will not read the last line of the manifest file if it doesn't end with an empty line.
Jesper de Jong wrote:You specify the entry point of the program (the main class) with a Main-Class attribute (not a Name attribute). I'm not sure if Name is a valid attribute in a manifest file.
Also, put a space between the : and the value of the attribute. Make sure that the manifest ends with an empty line; there's a known problem where Java will not read the last line of the manifest file if it doesn't end with an empty line.
In the meantime I have compiled my first minimalist version of the manifest file with the following command line and manifest file; what tool do I need to create a SHA-5 signature?
Microsoft Windows XP [Version 5.1.2600]
>jar cfm FileChooser.jar JFileChooser.mf *.class
>type JFileChooser.mf
Manifest-Version: 1.0
I guess you want to do that because you want to digitally sign your JAR file? The tutorial explains that in detail in this part: Signing and Verifying JAR Files.
Normally it's not required to sign your JAR file. You only need to do that for applets for example, if the applet needs special privileges which go beyond what the normal applet sandbox runtime environment allows applets to do.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Manifest problem in creating a jar file (CLI)