Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Is it possible to put policy file in program?

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
When starting a server, normally I need to type: java XXXXXX.
I just wondering if I can put the fbn.policy into a java file, say, so that I can start the server like java XXX?
Thanks for any help.
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter -
You can assign a value within the server source if you want:
Properties props = System.getProperties();
props.put("", "fbn.policy");
This hard-codes the policy by name, so if you want multiple policies without editing the same file for each use:
props.put("", args[0]);
where arg[0] is a command-line parameter instead of a directive (-D thingy).
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic