title: How to make an executable jar file using IntelliJ from a Selenium/TestNG java file?
body: <p>I've been Googling for days trying to figure out how to do this, if anybody has done this before I would greatly appreciate the help.</p>
  
  <p>I have an automation test project I've created in IntelliJ that automates a user interacting with a Web Application.  </p>
  
  <p>I'd like to put that automated test (created in Java, using Selenium and TestNG) into an executable jar file that others can run by double-clicking the jar file.</p>
  
  <p>Every time I attempt to create a jar file by navigating to Project Structure -> Artifact -> + -> Jar -> From modules with dependencies, it ends up creating a jar that claims it,</p>
  
  <pre><code>"Could not find or load the main class &lt;package.MainClass&gt; "
  </code></pre>
  
  <p>when I attempt to run it with the following command:</p>
  
  <pre><code>java -jar MyProject.jar &lt;Manifest Path&gt;
  </code></pre>
  
  <p>Any idea why I continually get this error, or have a way to do this successfully?</p>
  
  <p>Also, here is my pom.xml:</p>
  
  <pre><code>&lt;groupId&gt;TestAutomation&lt;/groupId&gt;
  &lt;artifactId&gt;TestAutomation&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                          &lt;mainClass&gt;com.test.automation.Executable&lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
                  &lt;descriptorRefs&gt;
                      &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                  &lt;/descriptorRefs&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-server&lt;/artifactId&gt;
          &lt;version&gt;2.39.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
          &lt;version&gt;2.40.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.11&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.testng&lt;/groupId&gt;
          &lt;artifactId&gt;testng&lt;/artifactId&gt;
          &lt;version&gt;6.1.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>