title: How to write a Java program which can extract a JAR file and store its data in specified directory (location)?
body: <p>I have created a <a href="http://en.wikipedia.org/wiki/JAR_file" rel="noreferrer">JAR</a> file. Now, I created another Java program. I want to unpack that JAR file in some other directory, meaning I want to do something like unzip.</p>
  
  <p>If I run <code>jar -xf filename.jar</code> this causes some error:</p>
  
  <pre><code>Exception in thread "main" java.io.IOException: Cannot run program "jar": 
  java.io.IOException: error=2, No such file or directory
       at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
       at java.lang.Runtime.exec(Runtime.java:593)`
  </code></pre>