Examples: getEnvironmentString method

  1. This application gets the value of the $EnvLoc environment variable.
    import lotus.domino.*;
    class getenvstring extends NotesThread
    {
      public static void main(String argv[])
        {
            getenvstring t = new getenvstring();
            t.start();
        }
      public void runNotes()
        {
        try
          {
            Session s = NotesFactory.createSession();
            String envloc = s.getEnvironmentString("EnvLoc", 
              false);
            if (envloc == null)
              System.out.println("No $EnvLoc");
            else
              System.out.println("$EnvLoc = " + envloc);
          }
        catch (Exception e)
          {
            e.printStackTrace();
          }
        }
    }
  2. This application gets the value of the MailServer system environment variable.
    import lotus.domino.*;
    class getenvstring2 extends NotesThread
    {
      public static void main(String argv[])
        {
            getenvstring2 t = new getenvstring2();
            t.start();
        }
      public void runNotes()
        {
        try
          {
            Session s = NotesFactory.createSession();
            String ms = s.getEnvironmentString("MailServer", 
              true);
            if (ms == null)
              System.out.println("No MailServer");
            else
              System.out.println("MailServer = " + ms);
          }
        catch (Exception e)
          {
            e.printStackTrace();
          }
        }
    }