codice:
import java.net.*;
import java.net.InetAddress;

public class testAddress {
  public static void main (String args[]) {
    try {
      InetAddress ia = InetAddress.getLocalHost();
      System.out.println(ia.getHostAddress());
    } catch (Exception e) {System.out.println("Something wrong");}
  }
}
sistema l'eccezione che è gestita di mota.
Ciao