Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

manifest.mf is overwritten by eclipse during jar export

I would like make an executable jar archive with eclipse. So into my project I created file src/META-INF/MANIFEST.MF :

Manifest-Version: 1.0
Main-Class: MainClass
Class-Path: .

But when I export my java eclipse project eclipse warn me with following message:

"JAR export finished with warnings. See details for additional information. myproject/src/META-INF/MANIFEST.MF was replaced by the generated MANIFEST.MF and is no longer in the JAR."

Anyone know how I can avoid this when I export my project in eclipse?

like image 552
freedev Avatar asked Jun 15 '10 13:06

freedev


2 Answers

While exporting the jar, select the option to use existing manifest and browse to the manifest file of your project. The generated jar will have that manifest file now.

Using existing manifest http://img46.imageshack.us/img46/6752/export.png

like image 64
Abhinav Sarkar Avatar answered Sep 29 '22 00:09

Abhinav Sarkar


Using Oxygen (Release 4.7.0), I was able to do this successfully. The confusing part is that on the JAR File Specification page of the JAR Export wizard, both the Next and Finish buttons are active. So if you don't notice that and just click Finish, you'll end up with a warning (and the generated manifest). To use your own, click Next instead (once for JAR Packaging Options, and again for JAR Manifest Specification).

like image 36
John Sichi Avatar answered Sep 29 '22 00:09

John Sichi