I want to connect Active Directory server using java and retrieve user names and password from it.If there is any way send me the relevant code or the method to do it.
You can Access Active Directory server using LDAP client...
I am not sure you will be able to access the password...but You can access all the other information related to User like its role, organization etc.
To start with first get a open source LDAP browser in java...
Use it to connect to your Active Directory Server so that u can browse through user details. This will help you to understand/learn/explore how AD is organized and how u will query AD using LDAP
Also get open source LDAP client api it should have enough document to get you started.
If I find any sample code I will post that in next reply