0

I'm trying to compile a runnable jar file, and to do so, I wrote a manifest file. When eclipse is finished compiling, one of the warnings is 'Project/src/META-INF/MANIFEST.MF was replaced by the generated MANIFEST.MF and is no longer in the jar.' Why does this happen, and how do I stop it?

Thanks in advance.

TheSporech
  • 17
  • 5
  • 1
    There should be an option to use the manifest file of your workspace, it´s on the last page if you are using the standard export. The standard that is checked here is `Generate the manifest file`. – SomeJavaGuy Oct 29 '15 at 09:03
  • I just went back and tried to export it again, and couldn't see that option :|. My eclipse broke a while back, so i upgraded to Mars-1. I am also on Mac. Think that has anything to do with it? – TheSporech Oct 29 '15 at 09:05
  • as said in the accepted answer of [this question](http://stackoverflow.com/questions/3045668/ma nifest-mf-is-overwritten-by-ecplise-during-jar-export) there should be mark to do it, but it seems as it is no longer possible with eclipse and the runnable jar – SomeJavaGuy Oct 29 '15 at 09:11
  • If you're using a "Runnable jar" and there's no option about the manifest, perhaps just exporting as a "jar" will do what you want -- there is an option on the "jar" export to include a manifest, and to either generate one or use one that you write, and that would (help) make the jar one you could run with java -jar x.jar – arcy Oct 29 '15 at 09:44

1 Answers1

0

When you compile a Java project in Eclipse, the build process generates a new MANIFEST.MF file with default attributes and replaces the one you have created in your project's META-INF directory. This is why you are seeing the warning message.

To avoid this, you can instruct Eclipse to use your own manifest file instead of generating a new one. To do this, follow these steps:

Right-click on your project and select "Properties." In the Properties dialog, navigate to "Java Build Path" and select the "Libraries" tab. Expand the JRE System Library entry and select "Access rules." Click "Add" and enter "META-INF/MANIFEST.MF" as the "Access rule pattern." Select "Forbidden" as the "Resolution" and click "OK." Click "OK" to close the dialog and save the changes. Now, when you compile your project, Eclipse will use your own MANIFEST.MF file instead of generating a new one.