I am trying to build a java applet which downloads a file to the client machine. As a java application this code worked fine but when I tried as an applet it does nothing. I have signed the .jar file and am not getting any security error messages
The Code is:
import java.io.*;
import java.net.*;
import javax.swing.*;
public class printFile extends JApplet {
public void init(){
try{
java.io.BufferedInputStream in = new java.io.BufferedInputStream(new
java.net.URL("http://www.google.com").openStream());
java.io.FileOutputStream fos = new java.io.FileOutputStream("google.html");
java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024);
byte data[] = new byte[1024];
while(in.read(data,0,1024)>=0)
{
bout.write(data);
}
bout.close();
in.close();
} catch(IOException ioe){
}
}
}
Can anyone help?