Reputation: 9451
I wish to find the current username in scala.
On the command line I can do:
whoami
In python, I can do:
import getpass
user_name = getpass.getuser()
How do I find the username in Scala?
Upvotes: 7
Views: 4599
Reputation: 37852
You can use the Java API for this:
System.getProperty("user.name")
See more (Java) options here: Get login username in java
Upvotes: 13