title: Simple java class to download the file
body: <p>I am trying to download a file using simple java class using the following code:  </p>
  
  <pre><code>public class Download {  
  
       public static void main(String[] args) throws Exception {  
  
          Download d = new Download();  
          d.URLSetUp("http://www.sheldonbrown.com/web_sample1.html");  
       }  
  
      public String URLSetUp(String urlProp) throws Exception {  
  
          StringBuffer tempData = new StringBuffer();  
          String contentXML = "";  
          String line = "";  
          URL url1;  
           try {  
              url1 = new URL(urlProp);  
  
              URLConnection conn = url1.openConnection();  
  
              conn.setDoOutput(true);  
               OutputStreamWriter wr = new OutputStreamWriter(conn
                  .getOutputStream());  
  
               BufferedReader rd = new BufferedReader(new InputStreamReader(conn
                  .getInputStream()));  
                while ((line = rd.readLine()) != null) {  
                   tempData.append(line);  
               }  
               contentXML = tempData.toString();  
  
              wr.close();  
              rd.close();  
  
           } catch (MalformedURLException e) {  
  
               e.printStackTrace();  
           } catch (IOException e) {  
  
               e.printStackTrace();  
          }  
           if (contentXML != null) {  
               return contentXML;  
          } else {  
  
               System.out.println("Error");  
           }  
           return null;  
  
       }  
  }  
  </code></pre>
  
  <p>Its giving me following error:  </p>
  
  <pre><code>#  
  # An unexpected error has been detected by Java Runtime Environment:  
  #  
  #  Internal Error (434C41535326494C453041525345520E4350500B65), pid=5156, tid=4296  
  #  
  # Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode)  
  # An error report file with more information is saved as hs_err_pid5156.log  
  #  
  # If you would like to submit a bug report, please visit:  
  #   http://java.sun.com/webapps/bugreport/crash.jsp  
  #
  </code></pre>
  
  <p>Please let me know if any of you have got any soultion.  </p>
  
  <p>Thanks<br>
  Sneha</p>