0

I developed a Java Swing app with com.sun.net.httpserver in it, when it starts, it will run a mini server and the url to access it looks like this :

http://127.0.0.1:66/Resume_App?

or

http://localhost:66/Resume_App?

If I want to run it from another machine inside or outside our company, how do I find out the IP address it's running on to give to someone who wants to access it ?

There must be a way to run a command on the machine that is running that app to ID it's own IP address for others to access it. How to do it ? I tried ipconfig, but too much info to know which one to use.

Frank
  • 30,590
  • 58
  • 161
  • 244
  • 1
    Duplicate of http://stackoverflow.com/questions/9481865/getting-the-ip-address-of-the-current-machine-using-java Note the complications discussed in the accepted answer – Samuel Aug 10 '15 at 17:40

1 Answers1

1

You can call InetAddress.getLocalHost(). It will return IP address in textual form.

Munahil
  • 2,381
  • 1
  • 14
  • 24