title: java.net.MalformedURLException at java.net.URL.<init>(Unknown Source)
body: <p>I am trying to make a distributed web crawler in which the initial urls is given by the user in a textfield and the crawled urls are displayed on server and client consoles when the search button is pressed.
  My code is:</p>
  
  <pre><code>import java.net.*;
  import java.io.*;
  import java.util.Date;
  import java.io.File;
  
  import org.jsoup.Jsoup;
  import org.jsoup.nodes.Document;
  import org.jsoup.nodes.Element;
  
  import java.nio.channels.ReadableByteChannel;
  import java.nio.channels.Channels;
  import java.rmi.*;
  import java.util.*;
  import java.util.*;
  import java.awt.*;
  import javax.swing.*;
  import java.awt.event.*;;
  import java.lang.*;
  
  
  class UCDemo implements ActionListener {
      static String n1;
      JFrame f1;
      JPanel p1;
      JLabel l1;
      JLabel l2;
      JTextField t1;
      JButton b1;
  
      public void showFrame() {
          f1 = new JFrame("Web Crawler");
          p1 = new JPanel();
          f1.setSize(800, 800);
          f1.setVisible(true);
          f1.setBackground(Color.pink);
          f1.getContentPane().add(p1);
          l1 = new JLabel("Distributed Web Crawler");
          t1 = new JTextField(100);
          b1 = new JButton("Start");
          p1.add(l1);
          p1.add(t1);
          p1.add(b1);
          b1.addActionListener(this);
      }
  
      public void actionPerformed(ActionEvent ae) {
          if (ae.getSource() == b1) {
              InputStreamReader ir = new InputStreamReader(System.in);
              n1 = t1.getText();
          }
      }
  
      public static void main(String args[]) throws MalformedURLException, IOException, FileNotFoundException, NotBoundException, NullPointerException {
          int c = 0;
          UCDemo obj = new UCDemo();
          obj.showFrame();
          Document document = null;
          URL hp = new URL(n1);
          URLConnection hpcon = hp.openConnection();
          String dispServerURL = "rmi://" + args[0] + "/DispServer";
          DispServerIntf dispServerIntf = (DispServerIntf) Naming.lookup(dispServerURL);
          try {
              document = Jsoup.parse(hp, 3000);
          } catch (IOException e) {
              e.printStackTrace();
          }
          for (Element element : document.getElementsByTag("a")) {
              c++;
              ReadableByteChannel rbc = Channels.newChannel(hp.openStream());
              FileOutputStream fos = new FileOutputStream("te.html");
              fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
              if (c &lt;= 7) {
                  Document doc_tmp = null;
                  URL hp_tmp = new URL(element.attr("href"));
                  URLConnection hpcontmp = hp_tmp.openConnection();
                  /** try
                   {
                   doc_tmp=Jsoup.parse(hp_tmp,3000);
                   }
                   catch(IOException e)
                   {e.printStackTrace();
                   }
                   for (Element ele: doc_tmp.getElementsByTag("a"))
                   {
                   System.out.println(ele.attr("href"));
                   }**/
                  ReadableByteChannel rbc_tmp = Channels.newChannel(hp_tmp.openStream());
                  FileOutputStream fos_tmp = new FileOutputStream("te" + c + ".html");
                  fos_tmp.getChannel().transferFrom(rbc_tmp, 0, Long.MAX_VALUE);
              } else {
                  dispServerIntf.send(element.attr("href"));
              }
          }
          /** BufferedReader in=new BufferedReader(new         InputStreamReader(hpcon.getInputStream()));
           String inputline;
           while((inputline=in.readLine())!=null)
           System.out.println(inputline);
           in.close();**/
      }
  }
  </code></pre>
  
  <p>But when I run this code the GUI is displayed properly but it does not wait for the initial URL and throws MalformedURLException....Unknown Source.
  Please guide where is the problem in code.</p>