How can I get the external IP of my computer, solely using Java, without contacting any websites like below:
String ip = "";
try
{
URL whatismyip;
whatismyip = new URL("http://checkip.amazonaws.com");
BufferedReader in = null;
in = new BufferedReader(new InputStreamReader(whatismyip.openStream()));
ip = in.readLine();
} catch (UnknownHostException e)
{
e.printStackTrace();
} catch (MalformedURLException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
The reason I do not want this is if this site is down for even a day, I will have big problems.
EDIT:
To define the question a bit clearer: Does Java have any methods to get the user's machine IP, if so, what are they?