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


is there way distinguish java system property has been set command line using -d option system property got same value default?

e.g., program

class test {   public static void main(string[] args) {     system.out.println(system.getproperty("user.home"));   } } 

prints

/home/uckelman 

for me regardless of whether run

java test 

or

java -duser.home=/home/uckelman test 

is there jdk provides test distinguish these 2 situations?

one way command line arguments used start jvm , check returned list if given system property set or not.

runtimemxbean mx = managementfactory.getruntimemxbean(); system.out.println("command line args:\n" + mx.getinputarguments()); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -