Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect user logged on a computer using Java

I want to develop an Java application that can detect the user logged on a Window Domain. These credentials are going to be used to logging on the Java application.

How can I do this?

Thanks!

like image 263
VansFannel Avatar asked Apr 07 '09 11:04

VansFannel


2 Answers

System.getProperty("user.name") 
like image 131
Spencer Ruport Avatar answered Oct 14 '22 05:10

Spencer Ruport


If you need to domain name, you can use this :

  com.sun.security.auth.module.NTSystem NTSystem = new
          com.sun.security.auth.module.NTSystem();
  System.out.println(NTSystem.getName());
  System.out.println(NTSystem.getDomain());

Bye.

like image 12
RealHowTo Avatar answered Oct 14 '22 03:10

RealHowTo