Hi,
you can initialize your context also via a Properties Object wich you give to the InitialContext as Constructor Parameter on initialization.
Therefor you can Prompt for the IP @ starttime. Even better save it in an external file and prompt on missing "config"-file.