title: Unzipping an archive won't work when using Java, works in Terminal - Linux
body: <p>I'm trying to unpack/extract an archive, which is supplied in my program, containing binaries.
  The copy from within the jar to the file works just fine, but when I try to extract the zip, it returns unexpectedly and only copies half of a file, and ignores the other file completely.</p>
  
  <p>Here's a bit more detailed description:
  I'm trying to unzip an archive copied to a folder, from within the program's .jar.
  The program I'm using to unzip is "unzip" (comes with Linux).
  The command used to extract is:</p>
  
  <pre><code>unzip -o &lt;file&gt;.zip
  </code></pre>
  
  <p>which is exactly what I'm using in following code:</p>
  
  <pre><code>ProcessBuilder process = new ProcessBuilder();
  process.command("unzip", "-o", adb_tools.toString());
  process.redirectErrorStream(true);
  Process pr = process.start();
  String line;
  BufferedReader processReader = new BufferedReader(new InputStreamReader(pr.getInputStream()));
  while ((line = processReader.readLine()) != null) 
      log(Level.INFO, "Extracting Android Debugging Bridge: " + line, true);
  
  log(Level.INFO, "Android Debugging Bridge has been extracted and installed to system. Marking files as executable...", true);
  pr.destroy();
  processReader.close();
  </code></pre>
  
  <p>When I use the command directly via the Terminal, everything works fine, both files are extracted and inflated, and are executable, however, as mentioned above, when I use the command in Java, only one file gets copied (and even that only goes half way), and the other file is completely ignored.</p>
  
  <p>How can I fix this problem, and prevent this happening again, with different programs?</p>
  
  <p>Thanks in advance!</p>