Why does Java use -D to indicate system properties?
Asked Answered
F

2

12

Why is the flag that indicates a System property in Java -D? Surely there is some semantics to this letter choice, but I can't guess what it is.

Funky answered 26/4, 2011 at 14:19 Comment(1)
I guess it means Define.Fattal
S
23

It is short for setting a system define.

"define" debug to yes

-Ddebug=yes

There is some historical context, as other compilers use similar flags. For example, gcc uses -D to set a preprocessor define.

gcc -D debug=yes test.c

will compile test.c with a preprocessing environment where the preprocessor variable debug is set to yes.

Serrate answered 26/4, 2011 at 14:21 Comment(0)
C
3

"defines" properties. Properties aren't arguments, so you'd need a special identifier anyway.

Chole answered 26/4, 2011 at 14:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.