Hello I am making a addon for bukkit a minecraft server modding program. This program requires me to put a jar into a foulder with an addon text document to provide class locations anyway. Then it uses my class and cast it into the class into the a class that it requires my class to inherit from. I am trying to write a text file in the same directory as my program so i wrote this(it is for a money program) (playerName is a pramater i used it as the filename because it is the player you are keeping balance for)
try{
FileWriter fstream = new FileWriter(new File(".").getAbsolutePath()+File.separator+playerName + ".txt",true);
getLogger().log(Level.INFO,"trying to save text document to " + new File("").getAbsolutePath()+File.separator+playerName + ".tct");
writer = new BufferedWriter(fstream);
writer.write("30");
return 30;
}
catch(Exception err){
getLogger().log(Level.INFO, "Exception occoured!{0}", err.getMessage());
return -1;
}
when i try to read it with this code it throws an exception
BufferedReader reader = new BufferedReader(new FileReader(new File(".").getAbsolutePath()+"/"+playerName));
Integer i = Integer.getInteger(reader.readLine());
return i.intValue();
Also i cannot find the text document it suposedly wrote. Any advice? Also i would like to try to save it back a file so it is not saved in the .jar file but i dont know how to do that. Also is there a possibility it is saving the file in the folder that the program that is using the class? Thanks XD