Enabling the SecurityManager

suggest change

Java Virtual Machines (JVMs) can be run with a SecurityManager installed. The SecurityManager governs what the code running in the JVM is allowed to do, based on factors such as where the code was loaded from and what certificates were used to sign the code.

The SecurityManager can be installed by setting the java.security.manager system property on the command line when starting the JVM:

java -Djava.security.manager <main class name>

or programmatically from within Java code:

System.setSecurityManager(new SecurityManager())

The standard Java SecurityManager grants permissions on the basis of a Policy, which is defined in a policy file. If no policy file is specified, the default policy file is used: $JAVA_HOME/lib/security/java.policy on Java 8 (JRE root), and $JAVA_HOME/conf/security/java.policy from Java 9. Java 17 deprecates the security manager. From Java 24 it is disabled: the java.security.manager property is rejected at startup, and System.setSecurityManager throws UnsupportedOperationException.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents