• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Security Policy File

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I need to use a SecurityManager, How do I include the location of the policy file when starting the program, without command line inputs ?

Can I change my code to incorporate it? Or Do I have to have it as a Command Line input when I run the code..like the following;
java -Djava.security.policy=java.policy client.URLClient localhost

Would the latter be a bad way of doing this?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

To set a policy programmatically, you could try setting the property at runtime (it's just an ordinary system property, after all), and then installing a security manager. Not sure if it would work that way, though.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sham,

Not sure about your assignment, but mine explicitly forbids a.) Using a SecurityManager and B.) using command line arguments.

Double check your assignment before going further.

Kevin
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be careful, my spec prohibits command-line parameters.
If you need that or is having too much dificulties because you cannot use that, maybe you are doing more than you should.
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess all the assignments disallow the command line arguments.
 
Sham Delaney
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Yes, I have the B&S assignment. I am a little confused though. Use of a SecurityManager is forbidden, so does that mean i cannot use the following line.
if (System.getSecurityManager() == null)
System.setSecurityManager ( new RMISecurityManager() );

How do I get around this?
 
I'm so happy! And I wish to make this tiny ad happy too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic