title: Main-Class is not written to manifest of a jar
body: <p>when I create a jar file from .class files with either:</p>
  <blockquote>
  <p>jar cmvf META-INF/MANIFEST.MF MyApp.jar *.class</p>
  </blockquote>
  <p>or</p>
  <blockquote>
  <p>jar cmvf manifest.mf MyApp.jar *.class</p>
  </blockquote>
  <p>despite a line with main class in the manifest file:</p>
  <blockquote>
  <p>Manifest-Version: 1.0</p>
  <p>Created-By: 1.8.0_171 (Oracle Corporation)</p>
  <p>Main-Class: MainClassName</p>
  </blockquote>
  <p>I get an error when I start MyApp.jar</p>
  <blockquote>
  <p>java -jar MyApp.jar</p>
  <p>no main manifest attribute, in MyApp.jar</p>
  </blockquote>
  <p>when i unpack the jar (in some other folder) with:</p>
  <blockquote>
  <p>jar xf MyApp.jar</p>
  </blockquote>
  <p>the manifest looks like this:</p>
  <blockquote>
  <p>Manifest-Version: 1.0</p>
  <p>Created-By: 1.8.0_171 (Oracle Corporation)</p>
  </blockquote>
  <p>why main class line disappears? &quot;MainClassName.class&quot; is in this folder and it has main function in it. Here is the output when i create the jar:</p>
  <blockquote>
  <p>added manifest</p>
  <p>adding: SomeClass.class(in = 1106) (out= 472)(deflated 57%)</p>
  <p>... other classes ...</p>
  </blockquote>
  <p>Thanks in advance.</p>
  <p><strong>[SOLUTION]</strong> thanks to dave</p>
  <blockquote>
  <p>(Especially on Windows) Make sure the last line, here the Main-class: line, has a line terminator aka newline (LF or CRLF). If the last line is unterminated it is ignored. (Officially there should actually be a second newline, thus an empty line, at the end of the manifest main-section, but IME it works without that.)</p>
  </blockquote>