I created a JAVA applet which downloads a file from the internet to the memory, do some operations with it, and then writes to the disk. I know that i have to sign the applet and create policy files, i did that but that didn't work.
Here is the code:
public static ByteArrayOutputStream file_kikodolva = new ByteArrayOutputStream() { ... data ...};
public void bt_save_click()
{
FileOutputStream output = null;
try {
FileDialog fileDialog = new FileDialog(new Frame(), "Save", FileDialog.SAVE);
fileDialog.setFilenameFilter(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".txt");
}
});
fileDialog.setFile(GlobalData.filename);
fileDialog.setVisible(true);
if (fileDialog.getFile() != null)
{
System.out.println("File: " + fileDialog.getDirectory() + fileDialog.getFile());
String filename = fileDialog.getFile();
output = new FileOutputStream(filename);
output.write( GlobalData.file_kikodolva.toByteArray());
output.close();
System.out.println("File saved: "+ fileDialog.getDirectory() + fileDialog.getFile());
lb_save.setText("Saved.");
bt_save.enable(false);
}else
{
lb_save.setText("User canceled.");
}
} catch (IOException ex) {
System.out.println("File write error");
Logger.getLogger(Send.class.getName()).log(Level.SEVERE, null, ex);
}
finally {
try {
output.close();
} catch (IOException ex) {
Logger.getLogger(Send.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
I also tried to use Jar Maker. Here is what i did: NetBeans -> Ctrl + F11 -> create jar file I used KeyMaker to create Signer jar file.
Do you have any suggestions how can i make this work?