tags:

views:

1317

answers:

2

I see many similar questions, however I want to find the Username of the currently logged in user using Java.

Its probably something like:

System.getProperty(current.user);

But, I'm not quite sure.

+11  A: 

You're actually really close. This is what you're looking for:

System.getProperty("user.name")
Chris Bunch
+2  A: 

The commonly available system properties are documented in the System.getProperties() method.

As Chris said "user.name" is the property to get the user running your app.

John Meagher