How can I get the hostname from the url using Java. I tried below:
InetAddress.getByName(new URL(url).getHostName());
This works only if the host