2012年5月8日星期二

environment - Java current machine name and logged in user? - Stack Overflow

environment - Java current machine name and logged in user? - Stack Overflow



To get the currently logged in user:
System.getProperty("user.name");
To get the host name of the machine:
InetAddress.getLocalHost().getHostName();

没有评论: