📄 e212. enabling the security manager.txt
字号:
By default, no security manager is enabled which means that all security checks to protected resources and operations are disabled. To enable security checks, the security manager must be enabled.
Once enabled, policy files determine the type of access an entity has on a resource. For more details, see e220 Managing Policy Files.
This example enables the security manager.
// Before the security manager is enabled, this call is possible
System.setProperty("java.version", "malicious data");
try {
// Enable the security manager
SecurityManager sm = new SecurityManager();
System.setSecurityManager(sm);
} catch (SecurityException se) {
// SecurityManager already set
}
// This call is no longer possible; an AccessControlException is thrown
System.setProperty("java.version", "malicious data");
The security manager can also be installed from the command line:
> java -Djava.security.manager MyApp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -