title: How does file creation work in Java
body: <p>I am trying to create a file using</p>
  
  <blockquote>
    <p>File newFile = new File("myFile");</p>
  </blockquote>
  
  <p>However no file called "myFile" is created. This is within a Web application Project i.e. proper form to be pakaged as a WAR but I am calling it as part of a main method (just to see how this works).</p>
  
  <p>How can I make it so that a new file is created at a location relative to the current one i.e not have to put in an absolute path.</p>
  
  <p><b>EDIT:</b></p>
  
  <blockquote>
    <p>newFile.createFile();</p>
  </blockquote>
  
  <p>Doesn't seem to work:</p>
  
  <p>Here is the entire code:</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  
  public class Tester {
  
  public static void main(String[] args) throws IOException{
      Tester test = new Tester();
      test.makeFile();
  }
  
  public void makeFile() throws IOException{
      File newFile = new File("myFile");
      newFile.createNewFile();
      }
  }
  </code></pre>