Апплет должен быть подписан для доступа к файловой системе.
public String downloadFile(final String filename) {
return (String)AccessController.doPrivileged(new PrivilegedAction(){
public Object run() {
try {
// downloadURL is the server URL say http://localhost/downloads
// filename is a file want to download from the server
// localpath is the path you want to download in the file system
URL finalURL = new URL(downloadURL + filename);
ReadableByteChannel rbc = Channels.newChannel(finalURL.openStream());
FileOutputStream fos = new FileOutputStream("/"+localpath.replace("\\","/") + filename);
fos.getChannel().transferFrom(rbc, 0, 1 << 24);
fos.close();
return "true";
}catch (ConnectException ce) {
e.printStackTrace();
return "false";
}
catch (Exception e) {
e.printStackTrace();
return "false";
}
}
});
}