To get windows username Im using the following code.
Code:
public class GetWindowUsername { public String getUser() { String userName = System.getProperty("user.name"); System.out.println("Window's Username: "+userName); return userName; } } public class TestUserName { public static void main(String args[]) { GetWindowUsername g = new GetWindowUsername();