Sunday, September 18, 2011

Eclipse's exported jar fails to include the entry for "SplashScreen-Image" in the exported MANIFEST.MF file.

For exporting my project as jar - i've built a custom MANIFEST.MF file in my project which can be selected for creating the jar. The MANIFEST.MF file in the project appears as below:

Manifest-Version: 1.0
Class-Path: lib/external1.jar lib/external2.jar
Main-Class: main.Main
SplashScreen-Image: MySplashImage.jpg

After the jar has been fully exported. On checking the MANIFEST.MF file in the exported jar - only the following entries appear:

Manifest-Version: 1.0
Class-Path: lib/external1.jar lib/external2.jar
Main-Class: main.Main

Solution:

Re-arrange the projects MANIFEST.MF entries such that the Main-Class entry appears at the very end. For example:

Manifest-Version: 1.0
Class-Path: lib/external1.jar lib/external2.jar
SplashScreen-Image: MySplashImage.jpg
Main-Class: main.Main

Now exporting the jar using the modified MANIFEST.MF jar will have proper MANIFEST.MF file with all its entries.

No comments: