I am using a text file to save the high score of a game. If the file doesn't exist and the game is exported as a .jar app everything works fine, but when i export it as a web page, obviously the game can't create the score file. So my question is how do i get the program to continue after failing to create the file. This creates and reads the file:
String hS;
File scores = new File("scores.txt");
public void act()
{
if(!scores.exists()){
try{
scores.createNewFile();
}
catch (Exception e){} //I'm guessing this is where it stops after failing file creation
if(scores.exists()){
try{
BufferedWriter out = new BufferedWriter(new FileWriter("scores.txt"));
out.write(""+0);
out.close();
}
catch(Exception e){}
}
}
if(scores.exists()){
try{
BufferedReader in = new BufferedReader(new FileReader("scores.txt"));
hS = in.readLine();
}
catch(Exception e){}
}
else hS = "Not available...";
setText(""+hS);
}

