hi
Im trying to save an int[] to a file, where each int is printed to a new line in a file. When the program is run from eclipse and is not jarred the file is saved to the parent map even when I havent specified any special map.
I use a printwriter like this:
PrintWriter(new FileWriter(filename+fileEnding), true);
I have tried to use “/filename.txt” but that doesnt change anything. Also when I try to load the file it works, but when i put the program in a jar it saves the file outside the jar,and it should, but it cant load the file because it doesnt find it.
What is the correct syntax for specifying the directory that the jar file is in?
This is what I use to read in the file line by line
new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("./"+mapname+fileEnding)));
Should I use anything else than InputStreamReader maybe?