Hi Ariel,

Thanks for your reply. I see that the latest version available is 3.3.0
Release Candidate 7. If you are using version 3.4... are you  one of the
developers?

I have version 3.2 from Ubuntu repository. I believe that should be fine
too.

I had not tried TextReplace.java from the distribution. So I picked it from
my local installation

/usr/lib/openoffice/basis3.2/sdk/examples/java/Text/TextReplace.java

created a plain java project in my NetBeans IDE. Added the library
"OpenOffice.org" which has the following jars:

/usr/lib/openoffice/basis3.2/ure-link/share/java/juh.jar
/usr/lib/openoffice/basis3.2/ure-link/share/java/jurt.jar
/usr/lib/openoffice/basis3.2/ure-link/share/java/ridl.jar
/usr/lib/openoffice/basis3.2/program/classes/unoil.jar


and compiled it, OK. When I run it (from IDE) I get the following Exception:

run:
com.sun.star.comp.helper.BootstrapException: no office executable found!
        at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:246)
        at TextReplace.main(TextReplace.java:64)
BUILD SUCCESSFUL (total time: 3 seconds)

I found this article and I followed it:

http://technology.amis.nl/blog/1243/getting-started-with-the-openofficeorg-api-part-i-connecting-to-openofficeorg

from command line, i set the following classpath value:

CLASSPATH=.:/usr/share/java/openoffice/:/usr/lib/openoffice/basis3.2/ure-link/share/java/juh.jar:/usr/lib/openoffice/basis3.2/ure-link/share/java/jurt.jar:/usr/lib/openoffice/basis3.2/ure-link/share/java/ridl.jar:/usr/lib/openoffice/basis3.2/program/classes/unoil.jar

and from my project build directory executed it as follows:

java -Dcom.sun.star.lib.loader.unopath="/usr/lib/openoffice/"
com.sun.star.lib.loader.Loader TextReplace

The above failed since com.sun.star.lib.loader.Loader was not found. May be
that article is bit old.

So I ran it like this and still got NoClassDefFoundError:

har...@mylinux:~/NetBeansProjects/OOEx-TextReplace/build/classes$ java
-Dcom.sun.star.lib.loader.unopath="/usr/lib/openoffice/"
com.sun.star.comp.loader.JavaLoader TextReplace
Exception in thread "main" java.lang.NoClassDefFoundError:
com/sun/star/comp/loader/JavaLoader
Caused by: java.lang.ClassNotFoundException:
com.sun.star.comp.loader.JavaLoader
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.sun.star.comp.loader.JavaLoader. Program
will exit.
har...@mylinux:~/NetBeansProjects/OOEx-TextReplace/build/classes$


I can verify that com.sun.star.comp.loader.JavaLoader is in classpath and it
is in jurt.jar. Any ideas? Since you can execute it, can you send me your
Classpath entries?

Regards,
Harsha


On Fri, Dec 10, 2010 at 7:57 AM, Ariel Constenla-Haile <
[email protected]> wrote:

> Hello Harsha,
>
> On Friday 10 December 2010, 02:47, Harsha Ravnikar wrote:
> > Hi,
> >
> > I am trying out OpenOffice example "TextReplace" available from the
> > following URL:
> >
> >
> http://wiki.services.openoffice.org/wiki/API/Samples/Java/Writer/TextReplac
> > e
> >
> > I am also using bootstrapconnector.jar available from
> > http://user.services.openoffice.org/en/forum/viewtopic.php?t=2520
> >
> > While executing it, I get the following exception:
> >
> > com.sun.star.comp.helper.BootstrapException
> >         at
> > ooo.connector.BootstrapConnector.connect(BootstrapConnector.java:129)
> >         at
> >
> ooo.connector.BootstrapSocketConnector.connect(BootstrapSocketConnector.jav
> > a:68) at
> >
> ooo.connector.BootstrapSocketConnector.connect(BootstrapSocketConnector.jav
> > a:45) at
> >
> ooo.connector.BootstrapSocketConnector.bootstrap(BootstrapSocketConnector.j
> > ava:82) at
> >
> org.openoffice.sdk.example.text.TextReplace.getDesktop(TextReplace.java:175
> > ) at
> > org.openoffice.sdk.example.text.TextReplace.main(TextReplace.java:63)
> >
> >
> > I have pasted below the full method thats corresponds to
> > BootstrapConnector.java:129. Exception occurs when the statement
> > oooServer.start(oooAcceptOption);is executed. The exception occurs
> > even when OpenOffice write is running. Can
> > anyone let me know how to resolve this issue?
>
> this example does not throw the exception, it's the
>  bootstrapconnector.jar,
> so you should ask the one who delivers that jar.
> I don't have time to look at that forum, but simply reading that it
> suggests
> to hard-code the "folder of your OpenOffice.org executable to a String
> variable"
> makes this look rather suspicious to me.
>
> On the other hand, the TextReplace sample comes with the SDK, did you try
> to
> build it and run it in the SDK env.? I just did and works fine. The sample
> is
> in
> </opt/openoffice.org/basis3.4/>sdk/examples/java/Text/TextReplace.java
>
> Notice that the NetBeans project on that wiki page that you can download:
> http://wiki.services.openoffice.org/wiki/File:TextReplace.zip
> was outdated (made for OOo 2.4), and it misses the bootstrap glue code,
> that's
> why you get a com.sun.star.comp.helper.BootstrapException: no office
> executable
> found! even if you fix the missing OOo 2.4 library issue.
> I loaded a new version now, you can try it with the latest NetBeans and
> latest
> OOo (you just have to change the project's settings, because I'm working
> with
> a OOo 3.4).
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>

Reply via email to