Monday, June 3, 2013

How to get the logged in Host & User Details in Java

How to get the logged in Host Name & User Details in Java?

import java.net.InetAddress;

 String hostName = InetAddress.getLocalHost().getHostName();

To get logged in user name

String user = System.getProperty("user.name");

No comments:

Post a Comment