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)

Sign up to request clarification or add additional context in comments.

Comments

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?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.