Capturing user name logged into machine

Asked

Viewed 1,325 times

3

I need to add in my program a method where it will capture the logged user from the machine and then display it to the client.

The client will run the program, and then it will show you information about your computer that should include the user logged in to the machine.

Is there any way to do it without having to use the processBuilder?

1 answer

2


One way is with the getProperty():

System.getProperty("user.name")

You can take a lot of useful information with it about the JRE and the operating system.

The other existing forms are not recommended. In general this solves.

  • Ball show guy, simple thing more helped too! Thanks.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.