Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在java中获取客户端系统的用户名和域名,因为我可以使用request.getRemoteHost获取ip地址和主机名_Java_Inetaddress - Fatal编程技术网

如何在java中获取客户端系统的用户名和域名,因为我可以使用request.getRemoteHost获取ip地址和主机名

如何在java中获取客户端系统的用户名和域名,因为我可以使用request.getRemoteHost获取ip地址和主机名,java,inetaddress,Java,Inetaddress,如何在java中获取客户端系统的用户名和域名,因为我可以使用request.getRemoteHost获取ip地址和主机名 使用whoami获取服务器pc用户名。虽然我需要登录用户名,但您可以找到如下内容: out.print( "ip : "+request.getRemoteHost() ); InetAddress ip= InetAddress.getByName(""+request.getRemoteHost()); String

如何在java中获取客户端系统的用户名和域名,因为我可以使用
request.getRemoteHost
获取ip地址和主机名


使用whoami获取服务器pc用户名。虽然我需要登录用户名,但您可以找到如下内容:

        out.print( "ip : "+request.getRemoteHost() );

        InetAddress ip=  InetAddress.getByName(""+request.getRemoteHost());

        String host=ip.getHostName();
        InetAddress host1=ip;
        out.print("host "+host); 
可通过以下方式获取用户名:

    System.out.println(System.getenv().get("USERDOMAIN"));
    System.out.println(System.getenv().get("USERNAME"));

您可以找到如下内容:

        out.print( "ip : "+request.getRemoteHost() );

        InetAddress ip=  InetAddress.getByName(""+request.getRemoteHost());

        String host=ip.getHostName();
        InetAddress host1=ip;
        out.print("host "+host); 
可通过以下方式获取用户名:

    System.out.println(System.getenv().get("USERDOMAIN"));
    System.out.println(System.getenv().get("USERNAME"));

[通过此操作,我获得服务器域..我需要该域和用户登录的位置..我的服务器域名反映在其他pc上]通过此操作,我获得服务器域。。我需要用户登录的域和用户。。我的服务器域名正在其他pc上反映您可以检查USERDOMAIN\u ROAMINGPROFILE是否可用吗?[通过此操作我获取服务器域..我需要该域和用户登录的用户..我的服务器域名正在其他pc上反映]通过此操作我获取服务器域。。我需要用户登录的域和用户。。我的服务器域名反映在其他pcCan上,您可以检查USERDOMAIN\u ROAMINGPROFILE是否可用吗?