我在 Applet 中遇到了一些问题。这是该问题的链接。
我刚刚添加了 System.setSecurityManager(null)
我的小程序运行良好。我想知道,设置security manager为null会有什么影响?它会使数据不安全吗?或其他东西。
最佳答案
既然你说的是applet
来自 Security manager 的文档
Typically, a web applet runs with a security manager provided by the browser or Java Web Start plugin. Other kinds of applications normally run without a security manager, unless the application itself defines one. If no security manager is present, the application has no security policy and acts without restrictions.
因此,通过传递 null,您将禁用运行时环境的安全性。
例如,System.exit以退出状态终止Java虚拟机,调用SecurityManager.checkExit确保当前线程有关闭权限应用程序。
还有更多示例说明如果禁用安全管理器(如文件权限等)会发生什么。
请在将其设置为null
之前阅读完整文档,因此您欢迎应用程序和最终用户出现安全问题。
关于java - System.setSecurityManager(null) 的影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19487407/