Get current user name and machine name in Java

    System.out.println(System.getProperty("user.name"));
    java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();
    System.out.println(localMachine.getHostName());