My aim is to develop a program which runs in my machine and gives an alert when a user logins to a machine which is in another group in the network i.e., my machine is in different group and the other machine in another group but all are in the same network. Please help me to develop the program.
Sounds like a packet sniffer. You'll need to use JNI to integrate with native code components, since Java does not have access to the network on that level. There's a library on SourceForge called jpcap that can help with this.