Create a URL object using any of the constructor. eg.:- URL url=new URL("http://server/index.html"); To set the fields of the URL, use the set() method as follows: - url.set(protocol,host,port,file,ref); The set() method has following syntax:- protected void set(String protocol, String host, int port, String file, String ref) where protocol - the name of the protocol to use host - the name of the host port - the port number on the host file - the file on the host ref - the internal reference in the URL