[Solved] Wired Bootstrap class without the bootstrap method

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Solved] Wired Bootstrap class without the bootstrap method

Postby papertiger » Sun Aug 14, 2011 4:34 pm

Hi, Guys, i am a fresh man in the ooo. And while i first try to do the example( viewtopic.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   Expand viewCollapse view
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

Postby papertiger » Mon Aug 15, 2011 4:04 pm

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
papertiger
 
Posts: 4
Joined: Tue Aug 09, 2011 5:22 am


Return to External Programs

Who is online

Users browsing this forum: No registered users and 3 guests