1 Reply Latest reply on Mar 27, 2002 10:43 AM by Adrian Brock

    Runtime domain name determination

    osman vurgun Newbie

      Hi,

      I need to determine the servers (2.4.x) domain name at runtime.
      Is there a class that I can use which delivers the domain name the server was started with? Or is there some other environmental information which I can use?

      Is there anyone out there to help me out?


      Osman Vurgun

        • 1. Re: Runtime domain name determination
          Adrian Brock Master

          Since this is the JMX forum, you can get the
          MBean Server's default domain using the
          getDefaultDomain() method.

          However, I think you mean the domain name of the server.

          Start with
          InetAddress local = InetAddress.getLocalHost();

          Then you have two options
          local.getHostName();
          or
          local.getCanoncialHostName();

          The second method is potentially blocking because
          it can access a dns.

          Regards,
          Adrian