title: IntelliJ build wrong JAR: Could not find or load main class
body: <p>I have a simple example </p>
  
  <pre class="lang-java prettyprint-override"><code>public class FileSystemReadFile {
      public static void main(String[] args) throws IOException {
          System.out.println("Reading the file" + args[0]);
      }
  }
  </code></pre>
  
  <p>which is created in IntelliJ where I want to build JAR file; So what I did:</p>
  
  <ol>
  <li>Added Artifact with dependencies (presumably I have some);</li>
  <li>Ensure that <code>MANIFEST.MF</code> is located in <code>src\main\resources\META-INF\</code> as it is already mentioned somewhere here on the site.</li>
  <li>Run Artifact build which gave me JAR file in out folder and I run that jar file that said me "Could not find or load main class" <br> <code>java &lt;name&gt;.jar</code></li>
  </ol>
  
  <p>You may see that main class is added into MANIFEST and location of manifest is also fine.</p>
  
  <p><a href="https://i.stack.imgur.com/Wpa7W.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Wpa7W.jpg" alt="Project structure"></a></p>
  
  <p>When I open that created JAR file, I see the same MANIFEST content, I see lots of dependency modules, but I don't see my class! </p>
  
  <p><a href="https://i.stack.imgur.com/TgeDO.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/TgeDO.jpg" alt="enter image description here"></a></p>
  
  <p>I suspect that is a cause. Any ideas?</p>