Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
Name: skT45625 Date: 04/27/2000 java version "1.2.2" Classic VM (build JDK-1.2.2-004, native threads, symcjit) The jar tool on windows platform (verified on Win98 and Win2000) would skip the last line of manifest. Example: If the manifest has exactly the two following lines: Name: test/Test.class Java-bean: True then the following command jar cfm test.jar manifest.txt test/*.class will produce a jar file that can't be used as a Java Bean. If you open the jar and extract MANIFEST.MF, you will see that the last line in the original manifest file is missing. Additional Information provided upon request; --------------------------------- readme.txt: 1. Save all files in a folder "manifestbug", and cd into the Hello.java manifest1.txt manifest2.txt run.bat readme.txt 2. The only difference between "manifest1.txt" and "manifest2.txt" is the extra blank line in "manifest2.txt". Double-click both files in Windows Explorer should launch the files in a note pads. Move cursor to the end of the last line to verify the difference. 3. Run the batch file at the command line as follows: run 1 This will create "manifestbug.jar" using "manifest1.txt" at the parent directory. 4. Start BDK1.1 and load the new jar, you will see the following error: Jar file C:\BDK1.1\jars\manifestbug.jar didn't have any beans! Each jar file needs to contain a manifest file describing which entries are beans. You can should provide a suitable manifest when you create the jar. 5. Now repeat step 3 with the command run 2 This will create "manifestbug.jar" using "manifest2.txt" at the parent directory. 6. Start BDK1.1 and load the new jar, it will work! ========= Use jar or winzip to extract the MANIFEST.INF inside "manifestbug.jar", you will see why the first jar can't be used as a Java bean. Hello.java: --------- package manifestbug; import java.awt.*; public class Hello extends Canvas { public Hello() { setSize(60,30); } public void paint(Graphics g){ g.drawString( "Hello", 10, 20 ); } } manifest1.txt: ---------- Name: manifestbug/Hello.class Java-Bean: True manifest2.txt: ----------- Name: manifestbug/Hello.class Java-Bean: True run.bat: ----- @echo Creating manifestbug.jar with manifest%1.txt del *.class cd .. javac manifestbug\Hello.java jar cfm manifestbug.jar manifestbug\manifest%1.txt manifestbug\*.class cd manifestbug (Review ID: 103379) ======================================================================
|