-1

I have my custom policy file which I want to append to existing Java Policy programmatically but not from command prompt because there = for append and == to override.

If I try

System.setSecurityManager(new SecurityManager());
System.setProperty("java.security.policy","myPolicy.policy");

Then will it append with existing or override that ?

Mureinik
  • 297,002
  • 52
  • 306
  • 350

1 Answers1

0

In a general way, when you have a method prefixed with set it will not append anything but replace the curent value with the new one passed as an argument. The method that will append something are generally prefixed with add.

So the value myPolicy.policy will override the existing one (if there is one) for the property java.security.policy.

romfret
  • 391
  • 2
  • 11