Setting System property from command line in grails « Intelligrape Groovy & Grails Blogs

Setting System property from command line in grails

Posted by

Hi,

In one of my recent grails project, i needed to set System property from command line while running the grails application.
I looked for it and found a simple solution to do so and found it worth sharing.


Suppose we want to set any property, say app.property=”propertyValue”, then the command to set the property in grails application would be:

  grails  -Dapp.property="propertyValue" run-app

Similarly to retrieve the value of System property, we use

String myPropertyValue= System.getProperty("app.property")

It helped me a lot..
Hope it helps


Vishal Sahu
vishal@intelligrape.com
www.intelligrape.com

Tags: ,
This entry was posted on August 24th, 2011 at 3:56 pm and is filed under Grails, Java tools, Linux, System . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply