Thursday, 15 January 2015

Can command-line set Java system properties be distinguished from the defaults? -


Is there a way to differentiate a Java system property which by default -D Got the same value?

For example, this program

  class test {public static void main} (string [] args) {System.out.println (System.getProperty ("user. Home ")); }}  

print

  / home / uckelman  

for me to run it

  Java Test  

or

  Java-Duser.home = / home / uckelman test  

Is there anything that offers JDK which I can test to penetrate these two situations?

One way that command line arguments are used to start JVM and returned See the list if a given property is set or not. RuntimeMXBeanMX = ManagementFactory.getRuntimeMXBean (); System.out.println ("Command Line Erridge: \ n" + mx.getInputArguments ());


No comments:

Post a Comment