title: executing a jar file brought in by maven using java Runtime object
body: <p>I have a java code that runs a jar file. To do that I am using the runtime object and create a process like:</p>
  <pre><code>Runtime re = Runtime.getRuntime();
  Process jarProcess = re.exec(new String[]{&quot;java&quot;,&quot;-jar&quot;,&quot;src/resources/myjar.jar&quot;});
  </code></pre>
  <p>This works perfectly when I put my jar file in <code>src/resources/myjar.jar</code>. Now I want to improve this and instead of putting the jar file in the resources, I want to add a dependency to that jar in my .pom file and then use the jar file that maven pulls in. But I don't know how to do this. It seems that even when I hardcode my maven remote directory which is something like ~/.m2/... the process cannot be run. I don't get any error (unless I'm missing something) but the <code>jarProcess.exitValue()</code> is 1. So how can I update my code to refer and execute the jar file which is pulled in by Maven.</p>