我尝试将字节数据写入Web应用程序目录我使用以下代码但是我收到此错误java.io.FileNotFoundException:C:\ Users \ user \ workspace.metadata.plugins \ org.eclipse.wst.server。 core \ tmp0 \ wtpwebapps \ pagingpoc(访问被拒绝)
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));