If I specify a System property multiple times when invoking JVM which value is used?
Posted
by
RobV
on Stack Overflow
See other posts from Stack Overflow
or by RobV
Published on 2012-06-08T22:20:11Z
Indexed on
2012/06/08
22:40 UTC
Read the original article
Hit count: 297
If I specify a system property multiple times when invoking the JVM which value will I actually get when I retrieve the property? e.g.
java -Dprop=A -Dprop=B -jar my.jar
What will be the result when I call System.getProperty("prop");
?
The Java documentation on this does not really tell me anything useful on this front.
In my non-scientific testing on a couple of machines running different JVMs it seems like the last value is the one returned (which is actually the behavior I need) but I wondered if this behavior is actually defined officially anywhere or can it vary between JVMs?
© Stack Overflow or respective owner