Skip to content

Instantly share code, notes, and snippets.

@andreluizf
Created November 7, 2014 19:02
Show Gist options
  • Save andreluizf/c5d28c04ab2b04ce6316 to your computer and use it in GitHub Desktop.
Save andreluizf/c5d28c04ab2b04ce6316 to your computer and use it in GitHub Desktop.
pegar usuario logado no windows
public static void main(String[] args){
System.out.println(System.getProperty("user.name"));
//nome da maquina
InetAddress addr;
try{
addr = InetAddress.getLocalHost();
System.out.println(addr.getHostName());
}catch(UnknownHostException e){
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment