java - Collect information about current server in cross platform way -


we have java apps, may invoked command line or inside web server. either way log central database. useful able setup our java apps read hostname (or other unique identifier) on startup, can report server running on debugging purposes. there such mechanism in java?

i've used managementfactory#getruntimemxbean() debugging purposes. want name:

string localhostname = managementfactory.getruntimemxbean().getname(); 

returns name representing running java virtual machine. returned name string can arbitrary string , java virtual machine implementation can choose embed platform-specific useful information in returned name string. each running virtual machine have different name.


Comments