开发者

How to get Windows Domains in Java

I have some Windows PC's. I need to get the Windows domains available to this PC for logins. 开发者_JAVA百科Any ideas?


This only work if the USERDOMAIN is defined as an environment variable. I read in http://www.wilsonmar.com/1envvars.htm that %USERDOMAIN% is the User Domain Name.

If %USERDOMAIN% is the User Domain Name use this:

String UserDomainName = System.getenv("USERDOMAIN");


As suggested by the answer to this question, ActiveDirectory is an LDAP server. Here's an article on how to use it with Java.


Use WAFFLE. It support 'enumerating Active Directory domains and domain information.'


This is a Windows-only feature, so you probably will have to use JNA to access windows system functions, and then find the right function to do this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜