Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - Connect to neo office with Eclipse Java
Connect to neo office with Eclipse Java
 
   NeoOffice Forum Index -> NeoOffice Releases
View previous topic :: View next topic  
Author Message
Tekikke
Blue Pill


Joined: May 02, 2007
Posts: 4

PostPosted: Wed May 02, 2007 2:34 am    Post subject: Connect to neo office with Eclipse Java

Hi,

i need to connect to neo office and run a macro there.
but when i start with the following code, i always get in the Catch, and the 'connected to a running office' doesn't appear.

Does someone has an idea why this doesn't work correct?

Code:

try {
            com.sun.star.uno.XComponentContext xContext = null;
            xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
            xMCF = xContext.getServiceManager();
            if( xMCF != null ) {
         
                  System.out.println("Connected to a running office ...");
                    Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
                    xDesktop = (com.sun.star.frame.XDesktop)
                    com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, oDesktop);
                    com.sun.star.frame.XComponentLoader xComponentLoader =(com.sun.star.frame.XComponentLoader)
                    com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class, xDesktop);
                    com.sun.star.beans.PropertyValue xEmptyArgs[] = // empty property array
                    new com.sun.star.beans.PropertyValue[0];
                    com.sun.star.lang.XComponent xComponent = // text document
                    xComponentLoader.loadComponentFromURL ( "private:factory/swriter","_blank", 0, xEmptyArgs);                   
                    executecommand(xComponent,macroModule, temploc );
                    xComponent.dispose();
            }
            else{
               System.out.println("Not able to create desktop object.");
            }
        }       
        catch( Exception e) {
..............


i get the following error:

com.sun.star.comp.helper.BootstrapException: no office executable found!

i think its because i've copied the classes to a different location. because with eclipse i can't import clases who are part of a package. and NeoOffice is one big package..
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Wed May 02, 2007 8:39 am    Post subject: Re: Connect to neo office with Eclipse Java

Tekikke wrote:
i think its because i've copied the classes to a different location. because with eclipse i can't import clases who are part of a package. and NeoOffice is one big package..


I assume that you are using the OpenOffice.org SDK, right? If so, they have detailed instructions on how to configure and start OpenOffice.org before you execute your code. The OOo SDK classes work by making a socket connection to a running instance of OpenOffice.org or NeoOffice so you need to specify the host and port of the running intance somewhere in your code.

It has been a year or two since I last used the OOo SDK so I can't tell you what exactly is needed. For that, you will have to sift through the OOo SDK documentation.

Patrick
Back to top
Tekikke
Blue Pill


Joined: May 02, 2007
Posts: 4

PostPosted: Thu May 03, 2007 12:20 am    Post subject:

i use already the jar files from NeoOffice in eclipse.
If i do the same on a linux or windows system, 'openoffice' starts and execute the macro. But there should be something different on mac.

Does someone has any idea why NeoOffice doesn't start with this code?

grtzz
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Thu May 03, 2007 8:47 am    Post subject:

Copying the jar files from NeoOffice into Eclipse is not going to make it obvious to the OpenOffice.org SDK code (yes, that is what you are using) where NeoOffice is installed.

Again, the OpenOffice.org SDK code tries to launch NeoOffice or OpenOffice.org. Unless you following the OpenOffice.org SDK directions for specifying where it is installed, the SDK code will fail.

The OpenOffice.org SDK documentation is here:

http://udk.openoffice.org/common/man/spec/transparentofficecomponents.html

There are several path properties that the OpenOffice.org SDK says are required in that page. Read the page and use them.

Patrick
Back to top
Tekikke
Blue Pill


Joined: May 02, 2007
Posts: 4

PostPosted: Mon May 07, 2007 11:37 pm    Post subject:

i've imported the neoOffice, jar files again and i have another error now.


Code:

Exception in thread "main" java.lang.UnsatisfiedLinkError: createJNI
   at com.sun.star.lib.connections.pipe.PipeConnection.createJNI(Native Method)
   at com.sun.star.lib.connections.pipe.PipeConnection.<init>(PipeConnection.java:137)
   at com.sun.star.lib.connections.pipe.pipeConnector.connect(pipeConnector.java:145)
   at com.sun.star.comp.connections.Connector.connect(Connector.java:146)
   at com.sun.star.comp.urlresolver.UrlResolver$_UrlResolver.resolve(UrlResolver.java:133)
   at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:292)



Does someone has an idea what this error means, and what i can do to repair this error?
Back to top
Tekikke
Blue Pill


Joined: May 02, 2007
Posts: 4

PostPosted: Thu May 10, 2007 12:19 am    Post subject:

pluby wrote:


The OpenOffice.org SDK documentation is here:

http://udk.openoffice.org/common/man/spec/transparentofficecomponents.html

There are several path properties that the OpenOffice.org SDK says are required in that page. Read the page and use them.

Patrick


thx,

i've read that page a hundred time but i can't find anything i don't do.
I use the code to connect like its on that page.

But maybe it has something to see with the environment variables, i've searched the internet and there's something to find about. But always on un*x systems not on mac os. And the variables i've found for linux are not working on my mac.
Maybe someone knows something more about this?

grtzz
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> NeoOffice Releases All times are GMT - 7 Hours
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.