1

dedicated Linux server throws UnknownHostException.

InetAddress addr;
    try {
        addr = InetAddress.getLocalHost();
    } catch (UnknownHostException e) {
        throw new InstantiationError("cannot find hub ip");
    }
1

2 Answers 2

3

you might not have mapping of localhost in your system32\drivers\etc\hosts (win) /etc/hosts (linux)

0

Another option I found was this(which I like as I don't have to repeat the hostname in both files now)...

java getLocalHost() UnknownHostException /etc/hosts file differs linux api?

Not the answer you're looking for? Browse other questions tagged or ask your own question.