title: JAR files created by IntelliJ IDEA do not run
body: <p>I wrote a program that spans a few classes in IntelliJ and it works fine when I was testing it in the IDE. However, whenever I follow tutorials to make my project into a .jar executable, it does not run.</p>
  
  <p>The file in the out folder does not run when double-click on it and says "The Java JAR file "projectName.jar" could not be launched.</p>
  
  <p>When opening it from the terminal, I get the error "Could not find or load main class". I used "$ java -jar projectName.jar "</p>
  
  <p>I followed these steps:</p>
  
  <ol>
  <li>Open Project Structure, Artifacts and click the (+).</li>
  <li>Under JAR, from modules with dependencies.</li>
  <li>Point to the class with my main method and click OK.</li>
  <li>Click apply and OK to exit.</li>
  <li>Then I close project structure and open Build and then Build Artifacts...</li>
  <li>Then I click Build.</li>
  <li>Navigate to ~/IdeaProjects/projectName/out/artifacts/projectName_jar/projectName.jar</li>
  </ol>
  
  <p>Then I would try to run it but it does not run. My project has both a GUI and can be run from command lines. When I compiled the main method in Terminal, it worked fine, but I need a JAR file. I'm not sure what I should include in the question, since I'm sure that my code is unrelated. I also utilize Maven, not sure if that is related. Are there other things that I should be doing or adding to my project before I build the JAR? </p>