I am using Java 1.4.2_02-b03 on Windows (2000) and experience the following very strange behaviour, when trying to jarsign some archives to be used for Webstart…
Suppose the classes are in a folder named “packagename”.
Method A) Pack the JAR file with the following command:
jar -cf App.jar packagename
jar -tf App.jar
packagename/Mainclass.class
packagename/subpackage/
packagename/subpackage/Another.class
Now jarsign it and and verify it. Results in this report:
jarsigner -verify App.jar
Note: This jar contains unsigned entries which are not integrity-checked. Re-run with -verbose to list unsigned entries.
jarsigner -verify App.jar
smk 1023 Wed Feb 25 22:30:18 CET 2004 packagename/Mainclass.class
0 Wed Feb 25 22:29:44 CET 2004 packagename/subpackage/
smk 1972 Wed Feb 25 22:37:42 CET 2004 packagename/subpackage/Another.class
Method B) Pack the JAR file with the following command:
jar -cf App.jar packagename/*
jar -tf App.jar
packagename/Mainclass.class
packagename/subpackage/Another.class
Now jarsign it and verify it: everything is fine!
So the additional empty package names (=folders) in the JAR file of case A) cause the trouble? Why?
When I use the “-C” command for packing a JAR file, the folder names are always being included, and so the jarsigning fails.