[Solved] Wired Bootstrap class without the bootstrap method

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
papertiger
Posts: 4
Joined: Tue Aug 09, 2011 5:22 am

[Solved] Wired Bootstrap class without the bootstrap method

Post by papertiger »

Hi, Guys, i am a fresh man in the ooo. And while i first try to do the example( http://user.services.openoffice.org/en/ ... php?t=1013 ) which provide converting an odt to a pdf. I failed with a wired problem, which torture me almost a whole week. Hope somebody would be kindly to help me out.
I copy almost all code from the above link, and post it below.
My problem is :
In my juh.jar's Bootstrap class, there is no bootstrap method declared.
My environment:
Solaris 8 and ooo 3.0

Code: Select all

import com.sun.star.beans.PropertyValue;
import com.sun.star.bridge.XUnoUrlResolver;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XStorable;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;

class ConvertService{
       
     public static void main(String[] args) {
        String loadUrl="file:///export/home/test.odt";
        String storeUrl="file://export/home/conver.pdf";

        try {
            XComponentContext xContext = Bootstrap.bootstrap();
            XMultiComponentFactory xMultiComponentFactory = xContext.getServiceManager();
            XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,xMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xContext));

            Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_blank", 0, new PropertyValue[0]);

            PropertyValue[] conversionProperties = new PropertyValue[1];
            conversionProperties[0] = new PropertyValue();
            conversionProperties[0].Name = "FilterName";
            conversionProperties[0].Value = "writer_pdf_Export";

            XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class,objectDocumentToStore);
            xstorable.storeToURL(storeUrl,conversionProperties);
        }
        catch (java.lang.Exception e) {
            e.printStackTrace();
        }
        finally {
            System.exit(0);
        }
    }   
}
Hopes give me a hand or hint.
Last edited by Hagar Delest on Mon Aug 15, 2011 10:23 pm, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 3.1 on solaris 10.0
papertiger
Posts: 4
Joined: Tue Aug 09, 2011 5:22 am

Re: Wired Bootstrap class without the bootstrap method

Post by papertiger »

I have fixed the problem.
Just use the /opt/starsuite9/program/class/juh.jar replace the liabraray i used.
OpenOffice 3.1 on solaris 10.0
Post Reply