So yeah, I am making a Text-Based RPG, in the form of an applet. This applet writes to your APPDATA directory when opened. It works in the IDE, but when I try it in Firefox, it comes up with an error message. HERE is the link.
File otherWorldDirectory = new File(System.getenv("APPDATA") + "\\.otherWorld");
if (!otherWorldDirectory.exists()) {
//Adding the folder .otherWorld to the APPDATA
otherWorldDirectory.mkdir();
System.out.println("Directory '.otherWorld' created.");
} else {
//The folder .otherWorld already exists.
System.out.println("Directory '.otherWorld' is not created, it exists.");
}
This is the point of applets. They cannot access user's disk unless they are "trusted". You have to sign your applet to be able to access user's disk.