title: java.io.FileNotFoundException: (Access is denied)
body: <p>I'm trying to create some files dynamically in my Java project root. but I get the following error when I run the code. </p>
  
  <pre><code>java.io.FileNotFoundException: D:\POS_ALL\T_POS_NEWEST\TouchPosApplication\WebContent\zharaimages\279 (Access is denied)
  </code></pre>
  
  <p>Is it possible to write a file to the root project folder in Java? Here is the code used.</p>
  
  <pre><code>private void createImage(PosItemImageDTO imageDTO,String path) throws IOException {
          byte[] bytes = imageDTO.getPosItemImage();
          path = path + "\\";
          if(bytes!=null &amp;&amp; bytes.length&gt;0){
              OutputStream out = null;
              // BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes));
              File l = new  File(path);
  
              out = new BufferedOutputStream(new FileOutputStream(path));
              out.write(bytes);
  
              if (out != null) {
                  out.close();
              }
          }   
      }
  </code></pre>