title: java.io.IOException: Permission denied in Java
body: <p>I am trying to create a file into the same folder in my project, but I am not able to create that file dynamically. I am trying this:</p>
  
  <pre><code>try {
              System.out.println("path"+System.getProperty("user.dir"));
              File file = new File("/textfile.txt");
              file.createNewFile();
              //file.createNewFile();
          } catch (Exception e) {
              e.printStackTrace();
          }
  </code></pre>
  
  <p>What I am getting error is this:</p>
  
  <pre><code>java.io.IOException: Permission denied
  </code></pre>
  
  <p>Any suggestion will be welcomed.</p>