Detect user logged on a computer using Java

后端 未结 4 1298
野性不改
野性不改 2020-12-17 01:03

I want to develop an Java application that can detect the user logged on a Window Domain. These credentials are going to be used to logging on the Java application.

4条回答
  •  甜味超标
    2020-12-17 01:51

    Note: System.getProperty("user.name") will only work if the user launches the application. If the program is run by System or an application like LANDesk, then the user will come out as "SYSTEM" (under domain "NT AUTHORITY").

    In which case, the second solution using NTSystem will return the correct results.

提交回复
热议问题