Software Development

Understanding Java Security Manager in 5 minutes or less

General Idea

The general idea of Java Security Manager is to restrict what an application can do. This is important as it provides a separate environment for programs to do whatever they do without affecting the host system or other applications.


For instance, we only allow application MyApp to read and write files in some directory.

Here are some useful links:

Through the Security Manager, the applications are controlled with security policies ( .policy files).

Consider this source code file.


Running Java without Security Manager

Run your application from the command line prompt as follows.


Running Java with Security Manager

Now run it with -D option.



Since we did not specify a .policy file, Java uses a default .policy file.

Got comments, or suggestions? Please visit our Facebook page!

You Might Also Like