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.
\user.dir\tmp\tempfile.txt. I don't see how this file could be created in the current directory. Post the relevant code, explain us what you expect it to do, and what it does instead.user.dirwill not be automatically expanded. c) Programming by magic rarely works, try reading the documentation.