I would like to write a file into Java archive (JAR). What do I need to modify in my code?
private void menu_savegame(ActionEvent e) {
File config = new File("config");
try {
FileWriter fw = new FileWriter(config);
fw.append(Integer.toString(level.current));
fw.append("\n");
if (win){
fw.append(Integer.toString(ballCount));
}
else{
fw.append(Integer.toString(G));
}
fw.append("\n");
fw.append(Integer.toString(liveLeft));
fw.flush();
} catch (IOException e1) {
e1.printStackTrace();
}
}
I just would like this file to be written not to the folder, but into the Game.jar file - I have there all the game resources (images).