Josh Diehl
Josh Diehl

Reputation: 3079

Is it possible to specify Java System Properties when running Groovy from command line

Equivalent to java -Dprop="abc" app, but using groovy, like groovy -Dprop="abc" app.groovy

Basically the same question asked here, but negative answers there are relatively old. Anything new support this since 2007?

Upvotes: 5

Views: 8787

Answers (1)

Dave Newton
Dave Newton

Reputation: 160211

Sure; it works as-is:

$ cat sysenv.groovy
println System.getProperty("wat")
$ groovy -Dwat="hello" sysenv.groovy 
hello

Upvotes: 7

Related Questions