Examples: getEnvironmentValue method

  1. This application gets the value of the environment variable $EnvNum.
    import lotus.domino.*;
    class getenvval extends NotesThread
    {
      public static void main(String argv[])
        {
            getenvval t = new getenvval();
            t.start();
        }
      public void runNotes()
        {
        try
          {
            Session s = NotesFactory.createSession();
            Object envnum = s.getEnvironmentValue("EnvNum", 
              false);
            if (envnum == null)
              System.out.println("No $EnvNum");
            else
              System.out.println("$EnvNum = " + envnum);
          }
        catch (Exception e)
          {
            e.printStackTrace();
          }
        }
    }
  2. This application gets the value of the system environment variable.
import lotus.domino.*;
class getenvval2 extends NotesThread
{
  public static void main(String argv[])
    {
        getenvval2 t = new getenvval2();
        t.start();
    }
  public void runNotes()
    {
    try
      {
        Session s = NotesFactory.createSession();
        Object tz = s.getEnvironmentValue("TimeZone", true);
        if (tz == null)
          System.out.println("No TimeZone");
        else
          System.out.println("TimeZone = " + tz);
      }
    catch (Exception e)
      {
        e.printStackTrace();
      }
    }
}