try { InetAddress me = InetAddress.getLocalHost(); String dottedQuad = me.getHostAddress(); System.out.println("My address is " + dottedQuad); } catch (UnknownHostException ex) { System.out.println("I'm sorry. I don't know my own address."); }