Using this bit of code to try and set a policy file:
ClassLoader cl= getClass().getClassLoader();
URL policyURL =cl.getResource("res/policy/new_policy.policy");
System.setProperty("java.security.policy", policyURL.toString());
And I get a java.lang.NullPointerException
on the last line.
The file is in my project directory in the correct path.
Question: What could cause this exception?
Answer: Running from eclipse, the path was constructed relative to the main project folder, not the project's bin folder. Considering that, moving the res folder in the bin folder solved the issue without changing any of the code above.