I'm writing a web app where there are some JDBC operations to be done based on the system user name. Currently I'm using the below code to get the details.
String userID = System.getProperty("user.name");
public String getUserIDDetails() throws Exception {
System.out.println(userID);
return userID;
}
Also I've tried
String systemUserName = new com.sun.security.auth.module.NTSystem().getName();
But here the problem is, when I deploy this on tomcat and tell my collegue to run it using, http://mySystemIPAddress:portNumber/ProjectName
, in the console, it prints my system name instead of the system where this url is accessed from (currently my colleague's). None of the above two methods worked.
Please let me know how can I fix this and get the correct system name.
Thanks