0

I try to write byte data to web application directory I use the following code but i get this error java.io.FileNotFoundException: C:\Users\user\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\pagingpoc (Access is denied)

        String appPath = request.getServletContext().getRealPath("");
        String savePath = appPath + File.separator ;
        File dir = new File(savePath);
        System.out.println(appPath);
        System.out.println(savePath);
        System.out.println(dir);
        if (!dir.exists())
            dir.mkdirs();
        File serverFile = new File(dir.getAbsolutePath());
        BufferedOutputStream stream = new BufferedOutputStream(
                new FileOutputStream(serverFile));
ali ibrahim
  • 95
  • 1
  • 9

0 Answers0