I want to create a file in a new directory using the relative path. Creating the directory “tmp” is easy enough.
However, when I create the file, it is just located in the current directory not the new one. The code line is below.
File tempfile = new File("tempfile.txt");
Have tried this also:
File tempfile = new File("\\user.dir\\tmp\\tempfile.txt");
Clearly I’m misunderstanding how this method works. Your assistance is greatly appreciated.
EDIT: added currently used code line as well as the one I think might work for a relative path to clear up confusion.
BTW: For testing use @Rule and TemporaryFolder class to create temp files or folders