String policyProvider = System.getProperty("javax.security.jacc.policy.provider", JaccProvider.Policy.class.getName());
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Class policyClass = Class.forName(policyProvider, true, classLoader);
Policy policy = (Policy) policyClass.newInstance();
policy.refresh();
Policy.setPolicy(policy);
} catch (Exception e) {
throw new IllegalStateException("Could not install JACC Policy Provider: "+policyProvider, e);
}
}