+ 2
How can I work with a file in Java without knowing the path of that file?
I'm writing a simple game and so I need to storage some data of the previous matches, but I'd like to write the code in order to make it work in each directory of my pc. How can I do that?
3 Answers
+ 5
You have to create the file each time you run the program (unless the file is already existing) and you should use
System.getProperty("user.dir");
to get the current directory. Did I answered your question?
+ 2
Yeah, you did it perfectly, thanks
+ 1
well done Daniele Bonomi