sensimevanidus

17 March, 2010

To get the system’s domain name in a Windows environment, use:

System.getenv("userdomain")

Note that you’re actually calling the getenv method the java.lang.System class; but you don’t need to write the fully qualified name as all classes in the java.lang package are automatically imported.

More information about the getenv method can be found here.