Here
System.getProperty("user.name");
returns host-name of windows server 2008 machine instead of currently logged in user name.
Below is my code
final String user = System.getProperty("user.name");
logger.info("User Name : " + user);
I want to know how System.getProperty works in java and on windows server 2008? and why is it returning wrong value in this case?
Just checked this: System.getProperty("user.name");
returns the value from environment variable USERNAME
, so check what set USERNAME
says in CMD window
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With