title: How to execute 2 or multiple java file in maven using command line?
body: <p>I am new in maven and I would like to execute 2 java file at the same time. I read a few posts in StackOverflow and because I do have limited knowledge with maven, I couldn't understand how to do it. I attached my pom.xml file here and the command line that I am using in mac terminal is:</p>
  
  <p><strong>mvn compile exec:java -Dexec.mainClass="org.parallel.ParseThread1"</strong></p>
  
  <p>I have another file named: ParseThread2 and every time I am running them separately like this:</p>
  
  <p><strong>mvn compile exec:java -Dexec.mainClass="org.parallel.ParseThread1"</strong></p>
  
  <p><strong>mvn compile exec:java -Dexec.mainClass="org.parallel.ParseThread2"</strong></p>
  
  <p>I want to know if maven is capable of executing both at the same time. </p>
  
  <p>Few posts that i read was:</p>
  
  <p><a href="https://stackoverflow.com/questions/25156226/how-to-execute-multiple-ant-targets-in-maven">How to execute multiple ant targets in maven</a></p>
  
  <p><a href="https://stackoverflow.com/questions/37027526/executing-multiple-maven-profiles">Executing multiple maven profiles</a></p>
  
  <p><a href="https://stackoverflow.com/questions/4932944/maven-build-multiple-profiles-in-one-go">Maven Build multiple profiles in one go</a></p>
  
  <p>My pom.xml file is:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;org.parallel&lt;/groupId&gt;
    &lt;artifactId&gt;parallel&lt;/artifactId&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;parallel&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
        &lt;maven.compiler.source&gt;1.9&lt;/maven.compiler.source&gt;
        &lt;maven.compiler.target&gt;1.9&lt;/maven.compiler.target&gt;
    &lt;/properties&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.6&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  
    &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>