我有一个文件上传 Servlet 并尝试将一些文件存储为:
try{
File uploadedFile = new File(UPLOAD_DIRECTORY + fileName);
File uploadedFile = new File("/"+fileName);
item.write(uploadedFile);
}
catch (Exception e) {
e.printStackTrace();
}
之后,我收到以下错误:
java.security.AccessControlException: access denied (java.io.FilePermission /untitled.html write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
我该如何解决?