获取 FileSystemException“客户端不拥有所需的权限”在 Play 框架中使用 Files.createSymbolicLink
我正在尝试使用新的 Java 7 Files.createSymbolicLink() 方法!框架,我得到了以下异常:
RuntimeException occured : java.nio.file.FileSystemException: c:\work\foo\bar:
A required privilege is not held by the client.
这是我第一次遇到Java的权限模型,所以我明白发生了什么,但还不知道如何修复它(我想给予控制器更多权限)。
如果有人能比我更快地找到答案,我(和未来的读者)将不胜感激。
I'm trying to use the new Java 7 Files.createSymbolicLink() method within Play! Framework, and I got the following exception:
RuntimeException occured : java.nio.file.FileSystemException: c:\work\foo\bar:
A required privilege is not held by the client.
This is my first encounter with Java's permission model, so I understand what's going on, but don't yet know how to fix it (I'd like to give the Controllers more permissions).
If anyone can answer here faster than I'll find the answer, me (and future readers) will be grateful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不是java权限的问题,而是操作系统权限的问题。请参阅 FileSystemException。
FileSystemException 的子类有:AccessDeniedException、AtomicMoveNotSupportedException、DirectoryNotEmptyException、FileAlreadyExistsException、FileSystemLoopException、NoSuchFileException、NotDirectoryException、NotLinkException。
来自 AccessDeniedException:
当文件系统操作被拒绝时引发的已检查异常,通常是由于文件权限或其他访问检查所致。
此异常与拒绝访问文件时访问控制器或安全管理器引发的 AccessControlException 或 SecurityException 无关。
This isn't a problem with java permissions, but a problem with the operating system permissions. See FileSystemException.
The subclasses of FileSystemException are: AccessDeniedException, AtomicMoveNotSupportedException, DirectoryNotEmptyException, FileAlreadyExistsException, FileSystemLoopException, NoSuchFileException, NotDirectoryException, NotLinkException.
From AccessDeniedException:
Checked exception thrown when a file system operation is denied, typically due to a file permission or other access check.
This exception is not related to the AccessControlException or SecurityException thrown by access controllers or security managers when access to a file is denied.
看到这个答案后,并记住我正在 Windows 7 上运行 UAC,我知道这是一个 Windows 问题。
事实上,跑步时:
一切正常。
After seeing this answer, and remembering I am running on Windows 7 with UAC, I understand this is a Windows issue.
Indeed, when running:
everything works well.