有没有办法用Java锁定目录?
我的应用程序在 C:/ 驱动器上创建一个目录(文件夹),因为我不想暴露其中的所有数据,并且我不想加密其中的所有文件,我想知道是否有办法锁定文件夹,这样只有我的应用程序可以访问它,其他人不能通过Windows资源管理器或其他程序打开该文件夹,无论我的应用程序是否正在运行,这可行吗?
My app creates a directory(file folder) on C:/ drive, since I don't want to expose all the data in it, and I don't want to encrypt all files in it, I wonder if there is a way to lock the folder up, so only my app can access it, no other person through windows explorer or another program can open the folder, doesn't matter if my app is running or not, is it doable ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这本质上是不可能的。
没有什么是你的程序在用户机器上能做而他自己做不到的。 (可能需要反编译器和调试器的帮助)
This is inherently impossible.
There is nothing that your program can do on the user's machine that he cannot do himself. (possibly aided by a decompiler and a debugger)
不,操作系统不提供这种类型的功能。您可以查看文件锁(http://en.wikipedia.org/wiki/File_locking)但这些目的是为了防止“并发访问”而不是这种“锁定”。话虽如此,您应该问自己在这里想做什么,是保护信息(加密文件)还是防止意外配置更改(隐藏目录)?
Nope, operating systems just don't provide this type of facility. You can look at file locks (http://en.wikipedia.org/wiki/File_locking) but those are intended to prevent "concurrent access" not this sort of "lock". With that said, you should ask yourself what are you trying to do here, is it securing information (encrypted file) or preventing accidental configuration changes (hiding the directory)?