title: Getting java to save a HTML file
body: <p>I have code written in java that is grabbing the index page of a website, but when I try to save the file it saves a blank document.<br>
  Here is the code:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.net.URL;
  import java.net.URLConnection;
  import javax.swing.JOptionPane;
  import java.io.*;
  
  public class source {
  
     public static void main(String[] args) throws IOException {
  
      String filename;
  
      filename = JOptionPane.showInputDialog("Enter the site");
      PrintWriter outputFile = new PrintWriter("files\\"+filename+".html");
  
      URL url = new URL("http://"+filename);
  
  
      URLConnection con = url.openConnection();
      InputStream is =con.getInputStream();
  
      BufferedReader br = new BufferedReader(new InputStreamReader(is));
  
      String line = null;
  
  
      while ((line = br.readLine()) != null) {
          System.out.println(line);
          outputFile.println(line);
      }
      System.exit(0);
  }
  }
  </code></pre>
  
  <p>What am I doing wrong?<br> Is there anything that I need to add to save html?</p>