Snippet. Java. Get the Name of the Host without a Requestpublic static String getHostName() { String host_name = "localhost"; try { host_name = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { // NO OP we will just use localhost } return host_name; } Updated on: 21 Dec 2024 |
|