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?
You can use the Java API for this:
System.getProperty("user.name")
See more (Java) options here: Get login username in java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With