native-platform icon indicating copy to clipboard operation
native-platform copied to clipboard

Provide a method to get the system hostname

Open buko opened this issue 6 years ago • 2 comments

The native-platform project is really cool. Just discovered it today and really liking it! Thanks for it.

I would like to suggest that the native-platform project should provide a method for retrieving the system hostname. There's really no good and reliable way to do this using pure Java. But it's a very common requirement -- along with getting the current process PID -- for many applications.

There's another project https://github.com/mattsheppard/gethostname4j by @mattsheppard which already provides this functionality. It's MIT LICENSE. It may make sense to leverage that code or perhaps even merge that project this into this one.

Keep up the good work!

buko avatar Jun 10 '19 18:06 buko

Feel free to take it - it's 38 lines long :)

https://github.com/mattsheppard/gethostname4j/blob/master/src/main/java/com/kstruct/gethostname4j/Hostname.java

mattsheppard avatar Jun 11 '19 00:06 mattsheppard

Thanks @mattsheppard, I will borrow this at some point.

adammurdoch avatar Jun 11 '19 06:06 adammurdoch