title: Exception in thread "main" java.lang.NullPointerException : While trying to the run the jar file
body: <p>When i run the command <code>java -jar MyJar.jar</code> i get the following errors :</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source)
      at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
  </code></pre>
  
  <p>What errors are these ? What could be the reason i am getting these errors ?</p>
  
  <p>Before I packed the packages in a jar file the scene was :</p>
  
  <p><img src="https://i.stack.imgur.com/pthqV.jpg" alt="enter image description here"></p>
  
  <p>Then i packed the above files along with the packages by entering :</p>
  
  <pre><code>jar -cf MyJar.jar .\Design\*.class .\InterfaceImplementation\*.class .\Interfaces\*.class .\messenger\*.class Manifest.MF RemoteMethodImpl_Stub.class
  </code></pre>
  
  <p><em>NOTE :</em> When i unpack the jar file there is a folder named <code>META-INF</code> which also contains <code>MANIFEST.MF</code> but not the name of main class.</p>
  
  <p><em>The content of my MANIFEST.MF : <code>Main-Class : messenger.Messenger</code></em> also tried by putting a forward slash</p>