How to handle the variable passing using -D, like -Dcontext=web in Java code?
Asked
Active
Viewed 3,800 times
5
user705414
- 19,158
- 37
- 109
- 154
1 Answers
15
You can reference the variables you passed on the command line with -D like this:
String context = System.getProperty("context");
So if you passed -Dcontext=web then the context above will be web. Note that you'll get back a null if it's not set.
WhiteFang34
- 68,826
- 17
- 104
- 110