Jar policy file

I am packing a java application into a jar file, but it only packs class files. When I run the java program from the command line, this is usually what I should do:

java -Djava.security.policy = ".. \ java.policy" Server

My question is: is there a way to pack the jar file and include this policy file? For example, when a user wants to run a jar file, all he needs to do is enter:

java -jar server

+5
source share
1 answer

You can pack the policy into a jar file and write a control code to create a security manager from this policy file. The cool bootloader does the hard work. Here is a sample.

+8

All Articles