I don\'t want to modify anything in my java home directory, however, I am afraid that sometimes my default java.policy file may be too permissive. Is there a way for me to use a
A Common Mistake with Java SecurityManager:
To run with SecurityManager and default Java security policy, which is $JAVA_HOME/jre/lib/security/java.policy:
java -Djava.security.manager Main
To run with SecurityManager and only your custom security policy (ignoring default java security policy):
java -Djava.security.manager -Djava.security.policy==security.policy Main
To run with SecurityManager and default java security policy first, then your custom security policy:
java -Djava.security.manager -Djava.security.policy=security.policy Main
If you don't want a SecurityManager, then simply leave out java.security.policy to avoid any confusion.