Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can programatically add property to System properties

 
Herbert Kornfeld
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it possible to programmatically add a property to the System(class) properties - I know I can add some on the command line with -Dname=value but I am wondering if I can do it inside the application. I have already used System.setProperty but that seems to be only for updating already existing properties.
Many Thanks
 
Herbert Kornfeld
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After further testing - it is possible with the setProperty method.
So I answered my own question.
:roll:
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I answered my own question.
Glad we could help Herbert.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic