title: How to download file from internet in java
body: <p>I have a problem when I want to download file from internet in java. I try to used something like this:</p>
  
  <pre><code>    String stringUrl = "http://imageshack.us/a/img841/7762/formd.png";
      File file = new File("");       
          try {
              URL url = new URL(stringUrl);
              FileUtils.copyURLToFile(url, file);
          }
  </code></pre>
  
  <p>but I got an I/O exception.
  What is the best way to download file from internet and put it into 'File' object?</p>