views:

63

answers:

2

Both the systems described are Windows XP with Lotus Notes 8.5.

I have a Java app (sample code below) that uses notes.jar to interact with Lotus Notes. The app works fine on a system that has notes.ini in the Lotus install dir of c:\Program Files\Lotus\Notes and the user ID file is in c:\Program Files\Lotus\Notes\Data. The user has to type a password to login to Lotus. This system has HKLM\Software\Lotus\Notes\MultiUser set to 0 (single user system). On this machine, the below code displays good values on the four println’s.

On a problem system, this app prints the four headings but blanks for the four values (the user name, key filename, mailfile, and mailserver are all blank). This problem system has notes.ini and the user ID file in D:\Data\johnsmith\NotesData. Lotus is installed in C:\Program Files\Lotus\Notes. This problem system also has HKLM\Software\Lotus\Notes\MultiUser set to 1 (implying it is multiuser instead of single user). Finally, under Lotus’s File -> Security -> User Security dialog the "Log in to Notes using your operating system login" box is checked (so the user doesn’t type in a password to login to Lotus).

So, it appears that on the problem system, the notes.ini file can’t be found (since notes.ini is where the four output values are supposed to be read from). I’ve looked through the Notes.jar API and can’t see any way to specify the location of notes.ini. The dir where notes.ini resides is in the Windows PATH, but that doesn’t help.

Any help would be appreciated.

import java.io.*;
import lotus.domino.*;

public static void main(String[] args) throws IOException {
  try {
    NotesThread.sinitThread();
    Session session = NotesFactory.createSession();

    System.out.println("Common user name: " + session.getCommonUserName());
    System.out.println("KeyFilename: " + session.getEnvironmentString("KeyFilename", true));
    System.out.println("MailFile: " + session.getEnvironmentString("MailFile", true));
    System.out.println("MailServer: " + session.getEnvironmentString("MailServer", true));
  } catch (Exception ex) {
    ex.printStackTrace();
  } finally {
    NotesThread.stermThread();
  }
}
A: 

There is a number of things you can try:

1) Notes actually comes with its own JVM and I found using this JVM makes Java applications run more reliably with Notes classes since any eventually needed support library would be properly configured.

2) What happens if notes is already running before you start your program. There are 2 variations here: Checkbox "Don't prompt for a password from other Notes-based programs" is checked or unchecked

3) Make sure to switch to the directory where the Notes.ini is at home before you run the app. (And verify that the user can't see any other notes.ini variables)

stwissel
Those were good suggestions. Unfortunately none of them worked.
Dean Hill
A: 

As mentioned in the original question, if HKEY_LOCAL_MACHINE\Software\Lotus\Notes\MultiUser has a value of 1, then you have a multi-user installation (even if you are the only user of Lotus).

Here is a solution that worked. Find the location of Notes.ini, probably somewhere like C:\Documents and Settings(username)\Lotus. Edit or create the string value below and set it to your Notes.ini directory. HKEY_CURRENT_USER\Software\Lotus\Notes(optional-version)\NotesIniPath.

In a multi-user environment, Lotus Notes gets the ini filename from the NotesIniPath registry value.

Dean Hill