I found that on my OSX system I have "weird" setup. Java reads my user name as "root" instead of my actual user name. Turns out the code I used uses System.getPropery("user.name") call. So, I made up stand-alone snipped (I save it under test.java) which prints java system user.name property and my UNIX user name environment:
class UserName {
public static void main(String[] args) {
String name;
name = System.getProperty("user.name");
System.out.println("user.name="+name);
name = System.getenv("USER");
System.out.println("USER="+name);
}
}
if I compile it as javac test.java and then run it (under my account, not root one) as java UserName it prints the following:
user.name=root
USER=vk
My question is where/how java sets user.name and why it is set to root instead of my actual UNIX name. I'm not java expert and don't really know internals of System.getProperty API.
The second question is it possible to change this settings somehow in UNIX environment that it will read properly my user name.
Finally may be my environment or java configuration is broken and there is some hidden file (properties) which should be fixed.