
/*
 * Last changes made by $Author: andreas $, $Date: 2006-11-22 09:31:27 +0100 (Mi, 22 Nov 2006) $
 */
import ooo.connector.BootstrapSocketConnector;

import com.sun.star.beans.PropertyValue;
import com.sun.star.document.EventObject;
import com.sun.star.document.XEventBroadcaster;
import com.sun.star.document.XEventListener;
import com.sun.star.lang.XComponent;
import com.sun.star.uno.UnoRuntime;

/**
 * @author Andreas Bröker
 * @version $Revision: 11063 $
 */
public class Lo4ConnectionTest {

	public static void main(String[] args) {
		com.sun.star.uno.XComponentContext xContext = null;

		try {
			// get the remote office component context
			xContext = BootstrapSocketConnector
					.bootstrap("C:\\Program Files (x86)\\LibreOffice 4\\program");
			if (xContext != null)
				System.out.println("Connected to a running office ...");
			com.sun.star.lang.XMultiComponentFactory xMCF = xContext
					.getServiceManager();
			Object oDesktop = xMCF.createInstanceWithContext(
					"com.sun.star.frame.Desktop", xContext);
			com.sun.star.frame.XComponentLoader xCompLoader = (com.sun.star.frame.XComponentLoader) UnoRuntime
					.queryInterface(com.sun.star.frame.XComponentLoader.class,
							oDesktop);
			XComponent xComponent = xCompLoader.loadComponentFromURL(
					"private:factory/swriter", "_blank", 0,
					new PropertyValue[0]);

			XEventBroadcaster xEventBroadcaster = (XEventBroadcaster) UnoRuntime
					.queryInterface(XEventBroadcaster.class, xComponent);
			if (xEventBroadcaster != null) {
				// HERE COMES THE FIRST EXCEPTION
				xEventBroadcaster.addEventListener(new XEventListener() {

					@Override
					public void disposing(com.sun.star.lang.EventObject arg0) {
						System.out.println("disposing");
					}

					@Override
					public void notifyEvent(EventObject arg0) {
						System.out.println("notifyEvent");
					}
				});
			}

			System.exit(0);
		} catch (Throwable throwable) {
			throwable.printStackTrace();
		}
	}
}

@@ -106,56 +106,50 @@
 */%0D%0A
+%0D%0A
 import 
-ooo.connector.BootstrapSocketConnector;%0D%0A
+com.sun.star.beans.PropertyValue;
 %0D%0Aim
@@ -166,35 +166,37 @@
 un.star.
-beans.PropertyValue
+comp.helper.Bootstrap
 ;%0D%0Aimpor
@@ -693,90 +693,19 @@
 trap
-SocketConnector%0D%0A%09%09%09%09%09.bootstrap(%22C:%5C%5CProgram Files (x86)%5C%5CLibreOffice 4%5C%5Cprogram%22
+.bootstrap(
 );%0D%0A

Use javaunohelper's bootstrap also in test/example