Domino Code Fragment

Code Name*
Using environment variables
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.221.53.5
Description*
2. This agent example prints the value of a system environment variable. The second argument to getEnvironmentString is true so that a dollar sign is not prepended to the name of the environment variable.
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;


class getenvironmentstring extends NotesThread
{
 public static void main(String argv[])
   {
       getenvironmentstring t = new getenvironmentstring();
       t.start();
   }


 public void runNotes()
   {
   try
     {
       Session s = Session.newInstance();
       Database db;
       String ms = s.getEnvironmentString("MailServer", true);
       db = s.getDatabase(ms, "names.nsf");
       System.out.println
       ("Title of names.nsf: \"" + db.getTitle() + "\"");
     }
   catch (Exception e)
     {
       e.printStackTrace();
     }
   }
}