AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Policy file in a Jar

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Security and Java
View previous topic :: View next topic  
Author Message
James Poli
Guest





PostPosted: Wed Oct 13, 2004 6:54 pm    Post subject: Policy file in a Jar Reply with quote



Is there way to specify a policy file in a jar? I've tired different
url for this and can't seem to get it to work.

For example:

jar:file:c:test.jar!policy.file

doesn't work
Back to top
Remi Bastide
Guest





PostPosted: Thu Oct 14, 2004 11:43 am    Post subject: Re: Policy file in a Jar Reply with quote



James Poli <James.Poli (AT) sas (DOT) com> wrote:

Quote:
Is there way to specify a policy file in a jar? I've tired different
url for this and can't seem to get it to work.

For example:

jar:file:c:test.jar!policy.file

doesn't work

I've received (by email) the following answer to the same question a
while ago :

It is possible to include a policy file within a jar, and the
ClassLoader provides an elegant way to access it. Assuming a client
policy file with the name client.policy in a subdirectory of the jar
called "other" it is possible to obtain a URL to the policy by doing
the following:

ClassLoader cl = getClass().getClassLoader(); URL policyURL =
cl.getResource("other/client.policy");

then set the policy by doing:

System.setProperty("java.security.policy",policyURL.toString());

and finally set the security manager:

System.setSecurityManager(new RMISecurityManager());




Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Security and Java All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.