How get active directory domain name in java
<p>Tell me please
How can i get active directory domain name from java
I tried this
    System.out.println(System.getenv("USERDOMAIN"));
but I only get the name of the computer</p>

<p>======================</p>

<p>I did so
<code>InetAddress inet = InetAddress.getLocalHost();
            InetAddress[] ips = InetAddress.getAllByName(inet.getCanonicalHostName());
            usernameId.setText(System.getProperty("user.name"));
            if (ips != null) {
                for (int i = 0; i &lt; ips.length; i++) {
                    String[] str = ips[i].toString().split("/");
                    if (!(str[1].startsWith("169") || str[1].contains(":")))
                        System.out.println("Computer name: " + str[0] + "\nIp address: " + str[1]);
                    computernameId.setText(str[0]);</code></p>

<p>And i get ip address and computername.domainname</p>