title: Java - How to create a file in a directory using relative Path
body: <p>I want to create a file in a new directory using the relative path.  Creating the directory "tmp" is easy enough.</p>
  
  <p>However, when I create the file, it is just located in the current directory not the new one.  The code line is below.  </p>
  
  <pre><code>    File tempfile = new File("tempfile.txt");
  </code></pre>
  
  <p>Have tried this also:</p>
  
  <pre><code>    File tempfile = new File("\\user.dir\\tmp\\tempfile.txt");
  </code></pre>
  
  <p>Clearly I'm misunderstanding how this method works.  Your assistance is greatly appreciated.</p>
  
  <p>EDIT: added currently used code line as well as the one I think might work for a relative path to clear up confusion.</p>