How to launch an NSF from Eclipse Java

I was asked this question the other day from a business partner and thought there are a couple of ways to skin this cat.  You can launch a program from pure Java using the Runtime class.  On windows (which meand this is really a poor solution) the command would look something like this:

Runtime.getRuntime().exec( “rundll32 url.dll,FileProtocolHandler ” + notesURL );

Where notesURL would be something that looks like this:  “Notes:///852568BD0051EF1E/6AE46DA7E9B0F3C185257297005D6B2D/B43A4DC7CB1E82AF852575C300626805”

If you want to use a more basic approach, Eclipse has the Program class that allows you to launch an application.  By simply passing in the URL as the program the operating system will pass it on to the correct handler (much easier and cross platform aware).

import org.eclipse.swt.program.Program;


Program.launch(“Notes:///852568BD0051EF1E/6AE46DA7E9B0F3C185257297005D6B2D/B43A4DC7CB1E82AF852575C300626805”);

Lastly, in Notes 8.5.1 there will be a new Java UI API (but don’t hold my word to this) to launch databases and views with a single call.  It is similar to the LotusScript package.  This is available to business partners and anyone who has access to the Notes 8.5.1 code.  So if you have a direct need to use Notes API’s then this will work, otherwise I recommend using the SWT Program class.

NotesUIWorkspace ws = new NotesUIWorkspace();
ws.openDatabase( );

1 thought on “How to launch an NSF from Eclipse Java

  1. Sorry if this is a bit off topic, but I have been searching for a way to communicate with a local notes database through a java sidebar application in lotus notes. I have been searching around, but I have yet to find a functional tutorial. Is there anything you could recommend?

    Thanks,

    Ryan

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.