Reputation: 4640
With
java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
And aliases in the host file like
10.0.0.4 bar.com
10.0.0.5 a-a.foo.com a-b.foo.com a-c.foo.com ...
Im able to resolve bar.com with InetAddress.getByName("bar.com"). But If the line is getting bigger like 30 hosts and longer than 767 Chars a UnknownHostException is thrown.
How to let Java handle this line as should?
For example "ping bar.com" is doing the lookup correctly.
Upvotes: 0
Views: 1473
Reputation: 2020
There's a limit on the number of aliases per ip address depending on your system. Try adding another line for each x aliases where x is max number of aliases for your system which is 34 in your case.
https://library.netapp.com/ecmdocs/ECMP1368834/html/GUID-C6F3B6D1-232D-44BB-A76C-3304C19607A3.html
Upvotes: 2