tags:

views:

320

answers:

1
+3  Q: 

jar policy file

I'm packaging my java application into a jar file but it only packages the class files. When I run the java program from the command line, usually this is what I have to do:

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

My question is: is there a way to package a jar file and include this policy file? For instance, When the user wants to run the jar file, all he/she needs to do is type:

java -jar Server

+7  A: 

You can package the policy into the jar file and write some housekeeping code to create a security manager from the given policy file. The classloader does the hard work. Here is a sample.

whatnick