How to use relative path instead of absolute path?
问题 So I am having a strange issue with Java. I'm reading a writing files, so the path is important to me. I would like all files to be written and read from the relative path (i.e in the folder with the rest of my class and java files). I write files like so: FileWriter fw = new FileWriter(outfile,true); fw.write(data); fw.close(); where outfile is something like 'out.txt' (i.e. the name of the file we want the output to go in). The problem is, the file is created in /home/me/ instead of the