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.

[wp_ad_camp_1]

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.

[wp_ad_camp_2]

Running Java without Security Manager

Run your application from the command line prompt as follows.

Outputs

Running Java with Security Manager

Now run it with -D option.

Outputs

[wp_ad_camp_3]

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

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like