If I specify a System property multiple times when invoking JVM which value is used?
- by RobV
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?