[英]How can i get the username and domain name of client system in java as i can get the ip address and host name using request.getRemoteHost
out.print( "ip : "+request.getRemoteHost() );
InetAddress ip= InetAddress.getByName(""+request.getRemoteHost());
String host=ip.getHostName();
InetAddress host1=ip;
out.print("host "+host);
How can i get the username and domain name of client system in java as i can get the ip address and host name using request.getRemoteHost
.. 我如何获取Java中客户端系统的用户名和域名,因为我可以使用request.getRemoteHost
。获取IP地址和主机名。
using whoami am getting the server pc username. 使用whoami正在获取服务器pc用户名。 while i need the logged in username 虽然我需要登录的用户名
You can find like below: 您可以找到以下内容:
System.out.println(System.getenv().get("USERDOMAIN"));
System.out.println(System.getenv().get("USERNAME"));
User name can be obtained as below: 用户名可以通过以下方式获取:
System.out.println(System.getProperty("user.name"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.