No lsxbe in java.library.path; nlsxbe error with Java program

I’m having an issue running my Java program which uses Notes.jar to get data from a user’s mail file.

I saw there’s a related problem, but it’s Windows specific and nothing specific to the Mac: http://www-10.lotus.com/ldd/46dom.nsf/DateAllFlatweb/a0ef201ec3d869fb852569f2005076a2?OpenDocument

In my machine, os.name says “Mac OS X”. And have no idea how to get around this problem… Here’s my stack trace:

Exception in thread “Thread-3” java.lang.UnsatisfiedLinkError: /Applications/Notes.app/Contents/MacOS/liblsxbe.dylib:

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)

at java.lang.Runtime.loadLibrary0(Runtime.java:822)

at java.lang.System.loadLibrary(System.java:993)

at lotus.domino.NotesThread.load(Unknown Source)

at lotus.domino.NotesThread.checkLoaded(Unknown Source)

at lotus.domino.NotesThread.initThread(Unknown Source)

at lotus.domino.NotesThread.run(Unknown Source)

and my environment:

PATH: /usr/bin:/bin:/usr/sbin:/sbin:/Applications/Notes.app/Contents/MacOS

CLASSPATH: null

LD_LIBRARY_PATH: :/Applications/Notes.App/Contents/MacOS

os.name:Mac OS X

java.library.path:/Applications/Notes.App/Contents/MacOS

Has anybody been able to successfully run Notes/Java apps from Mac ? I have Mac OSX 10.5.6.

Subject: What exactly is your Java program trying to do?

Is it a standalone Java program using Notes.jar?Is it a foreground agent?

Is it a locally scheduled background agent?

Does it do any GUI UI (i.e., does it use AWT?)

Subject: Sample code

Hey Erik,

Here’s some sample code of what I’m trying to do:

    	// TODO figure out what the lsxbe error is all about

        NotesClientHandler npr = new NotesClientHandler();

        

        // Make use of Notes API to read some Lotus Notes properties.

        try 

        {

           npr.start();

           npr.join();

        }

        catch (Exception e) 

        {

        	log.writeToLog(new Date(), this.getClass(), e.toString());

        	try 

        	{

        		throw new Exception(e);

        	}

        	catch (Exception e1)

        	{

        		log.writeToLog(new Date(), this.getClass(), e1.toString());

        		e1.printStackTrace();            		

        	}

        }

NotesClientHandler extends NotesThread and here’s how the runNotes method looks like:

public void runNotes() {

    mailLocations = new ArrayList(2);

    try {

                    

        Session s = NotesFactory.createSession();

        if (password != null && password.length() != 0) {

            s = NotesFactory.createSessionWithFullAccess(password);

        }

  String userName = s.getUserName();

  Name nameObj = s.getUserNameObject();

  userName = nameObj.getCanonical();

}

    catch (NotesException e) {

        e.printStackTrace();

    }

}

Stepping through the code, the exception is generated at npr.join().

Subject: So where does this code appear?

In an agent (background? foreground?) or a standalone Java app?

The context is very important.

Subject: problem solved

Ok… so I finally was able to fix the problem.

I had to create a file (~/.profile) and in there define the DYLD_LIBRARY_PATH. Also, I had to close Notes and ensure that I was using Java 1.5.0. Once I met all these requirements, I got it to work. More info here: Socialize Me: Atlas for the Mac Is Here

Thanks!

Subject: context: standalone

Stand alone Java application