Hi,

Rony G. Flatscher wrote:
Hi there,

while using "Bootstrap.defaultBootstrap_InitialComponentContext()" I ran into the following problem(s) with OOo 1.1.4 and 1.9.118, using the Windows version (on XP with SP2):

   1. "juh" is not found, adding $SYSBINDIR to the Windows path
      environment variable (used for "java.library.path"), allowed me to
      get by it, then

do you have juh.jar in your classpath? You need jurt.jar, ridl.jar, unoil.jar, juh.jar and java_uno.jar

   2. "types.rdb" is not found, because it is being searched in the
      employed Java "directory/bin", instead of $SYSBINDIR as per the
      definitions in "uno.ini".

do you have configured your own env or do you try to bootrap UNO on a base of office installation? If office you need the office program dirctory in your PATH variable. But you can also try to use the simple bootstrap mechanism (see the SDK exmaples) which bootraps UNO, connect to an office (starts if necessary the default office) and returns the intial context from the office.

Juergen


Is it necessary to set up additional environment variables if using "Bootstrap.defaultBootstrap_InitialComponentContext()" or to register "juh.jar" somehow? If so, where would I find docs, readmes about it? (Found the section in the developers guide about registering jars, p.214ff; but shouldn't such fundamental jars be registered already?)

What follows is a little Java program, followed by its output in case 1) and 2).

------------------- cut here ------------------
import com.sun.star.beans.XPropertySet;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.uno.XCurrentContext;


public final class RgfUnoAnalyzeTest {

    public static XMultiServiceFactory defaultFactory=null;
    public static XComponentContext defaultContext=null;

    /** Static block to initialize static fields. */
    static {
        try
        {
defaultFactory=(XMultiServiceFactory)Bootstrap.createSimpleServiceManager();
            System.err.println("defaultFactory="+pp(defaultFactory));

System.err.println("UnoRuntime.queryInterface(XPropertySet.class, defaultFactory): "+ pp(UnoRuntime.queryInterface(XPropertySet.class, defaultFactory)));

XComponentContext ctxt=Bootstrap.defaultBootstrap_InitialComponentContext() ;
            System.err.println("ctxt="+pp(ctxt));

XMultiComponentFactory xmcf = (XMultiComponentFactory) ctxt.getServiceManager();
            System.err.println("xmcf="+pp(xmcf));
        }
        catch (Exception e)
        {
            System.err.println("Exception:" + pp(e) + "has occurred!");
        }
    }

    public static void main(String[] arguments) throws Exception {

        System.out.println("In main()...");
        System.exit(0);
    }

    private RgfUnoAnalyzeTest () {}

    public static String pp(Object o)
    {
        if (o==null) return "<null>  <=== <=== <===";
        return "<"+o.toString()+">";
    }
}
------------------- cut here ------------------


with the CLI-session:
------------------- cut here ------------------
F:\work\tmp\ooo\tst>java RgfUnoAnalyzeTest
defaultFactory=<[EMAIL PROTECTED]>
UnoRuntime.queryInterface(XPropertySet.class, defaultFactory): <null> <=== <=== <=== Exception in thread "main" java.lang.UnsatisfiedLinkError: no juh in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
        at java.lang.System.loadLibrary(System.java:834)
at com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext(Bootstrap.java:235) at com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext(Bootstrap.java:203)
        at RgfUnoAnalyzeTest.<clinit>(RgfUnoAnalyzeTest.java:27)

F:\work\tmp\ooo\tst>set path=%path%;D:\Programme\OpenOffice.org1.1.4\program

F:\work\tmp\ooo\tst>java RgfUnoAnalyzeTest
defaultFactory=<[EMAIL PROTECTED]>
UnoRuntime.queryInterface(XPropertySet.class, defaultFactory): <null> <=== <=== <=== Exception:<com.sun.star.uno.Exception: Couldn't open registry file:///E:/j2sdk1.4.2_06/bin/types.rdb for reading>has occurred!
In main()...
------------------- cut here ------------------


Any hints highly appreciated!

TIA,

---rony



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to