[dev] OO2 130 and OfficeBean
Hello, I try OfficeBean and have one problem : when I call program with OO jars (jars in OO_HOME/program/classes) it work fine I want import jars in my project, but then OfficeBean can't find soffice program OO seek soffice in /soffice always (linux) I link soffice to /soffice for check and get InteruptedException How I can set program location for OfficeBean ? Thanks Haris Peco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
snpe wrote: Hello, I try OfficeBean and have one problem : when I call program with OO jars (jars in OO_HOME/program/classes) it work fine I want import jars in my project, but then OfficeBean can't find soffice program OO seek soffice in /soffice always (linux) When using OOoBean then jars, such as jurt.jar, ridl.jar, etc. must be on the class path. They must also be located in the program classes directory. OOoBean uses com.sun.star.lib.util.NativeClassLoader (jurt.jar) to get the location of the executable. NativeClassLoader examines the parent directory of the jar, where it finds soffice. I link soffice to /soffice for check and get InteruptedException How I can set program location for OfficeBean ? One could use an UrlClassLoader that knows the location of soffice to load OOoBean. (never tested that before). Have a look at LocalOfficeConnection.getProgramPath and NativeLibraryLoader.getResource. Joachim. Thanks Haris Peco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
Joachim, On Tuesday 27 September 2005 08:19 am, Joachim Lingner wrote: > snpe wrote: > > Hello, > > I try OfficeBean and have one problem : > > > > when I call program with OO jars (jars in OO_HOME/program/classes) it work > > fine > > > > I want import jars in my project, but then OfficeBean can't find soffice > > program > > OO seek soffice in /soffice always (linux) > When using OOoBean then jars, such as jurt.jar, ridl.jar, etc. must be > on the class path. They must also be located in the program classes > directory. OOoBean uses com.sun.star.lib.util.NativeClassLoader > (jurt.jar) to get the location of the executable. NativeClassLoader > examines the parent directory of the jar, where it finds soffice. It is fine when jars are in original position Example : 1) create project and add jars from OFFICE_HOME/program/classes in classpath (no relocate jars, only add in classpath) - It work fine 2) create project, add jars from OFFICE_HOME/program/classes in my project folder (relocate it) - add relocated jars in classpath.It compile, load class, but can't find officebean libraries (libofficebean.so) - I add java.library.path=OFFICE_HOME/program and libofficebean.so is ok, but OOoBean can't find soffice program.I try add soffice in PATH, java.library.path,com.sun.star.beans.path without success - OOoBean seek soffice relative to jars files - I see NativeClassLoader and it search with loader of class LocalOfficeConnection and relative from officebean.jar - I think that loader have to seek in PATH yet (or OFFICE_HOME) It is simple add in LocalOfficeConnection#getProgramPath for seek in PATH (and/or OFFICE_HOME) > > > I link soffice to /soffice for check and get InteruptedException > > How I can set program location for OfficeBean ? > One could use an UrlClassLoader that knows the location of soffice to > load OOoBean. (never tested that before). > Have a look at LocalOfficeConnection.getProgramPath and > NativeLibraryLoader.getResource. > This not help, because NativeLibraryPath search urls directories (or parent directories) only If I relocate jars then it can't find soffice My workaround for now is : make classloader - use OFFICE_HOME env. variable for soffice libraries (add in path) dynamic and load OO classes dynamic with this, but I have to use reflection for calling OO method (I work in eclipse and can't change classloader on runtime, but OO doesn't use context classloader) It is much better that getProgramPath or NativeClassLoader use PATH (and yet any use variable) for search) There is yet another problem : I try officebean in KDE and it work fine in KDE, but when I set SAL_USE_VCLPLUGIN=gtk it doesn't work - no exception, office start, loadFromURL work fine, acquireSystemWindow work without exception but no connection (panel is empty) I try from gtk environment, but it isn't work , too (I don't test enough this, because my gnome is compiled and hard patched - gtk is 2.8.4) Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
Hi, It is fine when jars are in original position Example : 1) create project and add jars from OFFICE_HOME/program/classes in classpath (no relocate jars, only add in classpath) - It work fine 2) create project, add jars from OFFICE_HOME/program/classes in my project folder (relocate it) - add relocated jars in classpath.It compile, load class, but can't find officebean libraries (libofficebean.so) - I add java.library.path=OFFICE_HOME/program and libofficebean.so is ok, but OOoBean can't find soffice program.I try add soffice in PATH, java.library.path,com.sun.star.beans.path without success - OOoBean seek soffice relative to jars files - I see NativeClassLoader and it search with loader of class LocalOfficeConnection and relative from officebean.jar - I think that loader have to seek in PATH yet (or OFFICE_HOME) It is simple add in LocalOfficeConnection#getProgramPath for seek in PATH (and/or OFFICE_HOME) With the current design it is not supported that the jar files are relocated. That is, they must be located in the program/classes directory. In a sense, the office installation must be regarded as one entity and hence cannot be split up. I link soffice to /soffice for check and get InteruptedException How I can set program location for OfficeBean ? One could use an UrlClassLoader that knows the location of soffice to load OOoBean. (never tested that before). Have a look at LocalOfficeConnection.getProgramPath and NativeLibraryLoader.getResource. This not help, because NativeLibraryPath search urls directories (or parent directories) only If I relocate jars then it can't find soffice What I meant is, one could use an own class loader that knows the location of the office and which loads the class files of your application. This class loader is passed into the NativeClassLoader: File path = NativeLibraryLoader.getResource( LocalOfficeConnection.class.getClassLoader(), aExec); Then this loader would be asked to get the path to the executable. My workaround for now is : make classloader - use OFFICE_HOME env. variable for soffice libraries (add in path) dynamic and load OO classes dynamic with this, but I have to use reflection for calling OO method (I work in eclipse and can't change classloader on runtime, but OO doesn't use context classloader) We intent to extend the OOoBean to be used along with the simple bootstrap mechanism. There is an example in the SDK: SDK\examples\DevelopersGuide\ProfUNO\SimpleBootstrap_java which uses a special loader class to load the application. The loader class com.sun.star.lib.loader.Loader can be found in the project ODK: odk\source\com\sun\star\lib\loader\Loader A description about this bootstrap mechanism can be found in the Developer's Guide, chapter 3.4.1 "Java Language Binding", sub chapter "Transparent Use of Office UNO Components" However the OOoBean must be changed so that it can be passed an XComponentContext. The advantage would be that one can start the Java app (must be a jar) without putting all the office jars in the class path. It is much better that getProgramPath or NativeClassLoader use PATH (and yet any use variable) for search) Although this would be possible we once decided that applications must use the jars from the office installation which is being used (this allows to have different office installations). There is yet another problem : I try officebean in KDE and it work fine in KDE, but when I set SAL_USE_VCLPLUGIN=gtk it doesn't work - no exception, office start, loadFromURL work fine, acquireSystemWindow work without exception but no connection (panel is empty) I try from gtk environment, but it isn't work , too (I don't test enough this, because my gnome is compiled and hard patched - gtk is 2.8.4) I will put that on the list for testing. Thanks, Joachim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
On Wednesday 28 September 2005 10:54 am, Joachim Lingner wrote: Hi, > We intent to extend the OOoBean to be used along with the simple > bootstrap mechanism. > There is an example in the SDK: > SDK\examples\DevelopersGuide\ProfUNO\SimpleBootstrap_java > which uses a special loader class to load the application. The loader > class com.sun.star.lib.loader.Loader can be found in the project ODK: > odk\source\com\sun\star\lib\loader\Loader > A description about this bootstrap mechanism can be found in the > Developer's Guide, chapter 3.4.1 "Java Language Binding", sub chapter > "Transparent Use of Office UNO Components" > I try it > > > There is yet another problem : I try officebean in KDE and it work fine in > > KDE, but when I set > > SAL_USE_VCLPLUGIN=gtk it doesn't work - no exception, office start, > > loadFromURL work fine, > > acquireSystemWindow work without exception but no connection (panel is > > empty) > > I try from gtk environment, but it isn't work , too (I don't test enough > > this, because my gnome is compiled > > and hard patched - gtk is 2.8.4) > > I will put that on the list for testing. > I try it on ubuntu 5.10 with gnome 2.12 (gtk 2.8.3) and it doesn't work (your example OOoBeanViewer doesn't work , too) When I set SAL_USE_VCLPLUGIN=kde it work fine on ubuntu, too With gtk it haven't exception, connection (start) soffice is fine, but panel is empty Thanks Haris Peco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
On Wednesday 28 September 2005 10:54 am, Joachim Lingner wrote: Joachim, ... > We intent to extend the OOoBean to be used along with the simple > bootstrap mechanism. > There is an example in the SDK: > SDK\examples\DevelopersGuide\ProfUNO\SimpleBootstrap_java > which uses a special loader class to load the application. The loader > class com.sun.star.lib.loader.Loader can be found in the project ODK: > odk\source\com\sun\star\lib\loader\Loader > A description about this bootstrap mechanism can be found in the > Developer's Guide, chapter 3.4.1 "Java Language Binding", sub chapter > "Transparent Use of Office UNO Components" > > However the OOoBean must be changed so that it can be passed an > XComponentContext. The advantage would be that one can start the Java > app (must be a jar) without putting all the office jars in the class path. I try SimpleBootstrap_java.java (and another exampel form OfficeDev) and it work fine with both (kde and gtk).How I can add open OO frame to my Java panel (frame) ? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
On Wednesday 28 September 2005 07:05 pm, snpe wrote: > I try SimpleBootstrap_java.java (and another exampel form OfficeDev) and it > work fine with both (kde and gtk).How I can add open OO frame to my Java > panel (frame) ? > > Thanks I play with Desk.java from odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java and get this error when resize JSplitPane CE> CE> (soffice.bin:29942): Gdk-WARNING **: GdkWindow 0x360013f unexpectedly destroyed CE> CE> (soffice.bin:30014): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkWidget' CE> CE> (soffice.bin:30014): Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed resize doesn't work (it doeesn't work on kde, too) or this (soffice.bin:30377): Gdk-WARNING **: GdkWindow 0x3600038 unexpectedly destroyed CE> CE> (soffice.bin:30444): GLib-GObject-WARNING **: invalid uninstantiatable type `GObject-weak-references' in cast to `GtkWidget' CE> CE> (soffice.bin:30444): Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
I try SimpleBootstrap_java.java (and another exampel form OfficeDev) and it work fine with both (kde and gtk).How I can add open OO frame to my Java panel (frame) ? As I mentioned before, OOoBean needed a way to receive the component context to fully support this example. This is not yet implemented. But I may work nonetheless, because now the application and the bean will be loaded with a special classloader that knows the location of the jar files. Notice that this classloader is used by LocalOfficeConnection.getProgramPath to find the office. Did you try that out? Is the office located and started? Add the OOoBean to the panel as you would do with every other component. For example: m_bean = new com.sun.star.comp.beans.OOoBean(); add(m_bean, BorderLayout.CENTER); pack(); setBounds(x, y, width, height); setVisible(true); m_bean.loadFromURL("private:factory/swriter", null); validate(); //may not be necessary --Joachim Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
Joachim, > As I mentioned before, OOoBean needed a way to receive the component > context to fully support this example. This is not yet implemented. But > I may work nonetheless, because now the application and the bean will be > loaded with a special classloader that knows the location of the jar > files. Notice that this classloader is used by > LocalOfficeConnection.getProgramPath to find the office. > Did you try that out? Is the office located and started? > yes, when I have original jars path in classpath (jars are in OFFICE_HOME/program/classes) > Add the OOoBean to the panel as you would do with every other component. > For example: > > m_bean = new com.sun.star.comp.beans.OOoBean(); > add(m_bean, BorderLayout.CENTER); > pack(); > setBounds(x, y, width, height); > setVisible(true); > m_bean.loadFromURL("private:factory/swriter", null); > validate(); //may not be necessary > > --Joachim I try your suggestion, but I have any adding : after loadFromURL , I have to add aquireSystemWindow(). Panel must be in frame before aquireSystemWindow This is simple example - it work for SAL_USE_VCLPLUGIN=kde (I isn't important what I use : kde or gnome - it work only for kde) I try gtk 2.4.14,2.8.3,2.8.4 without success - frame is open, there isn't exception or error but office isn't in frame (I have empty frame - background color is from gnome) I try with java.awt.Frame instead javax.swing.JFrame - it is same Thanks Haris Peco example : package firststeps; import java.awt.BorderLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import javax.swing.JFrame; import com.sun.star.comp.beans.NoConnectionException; import com.sun.star.comp.beans.OOoBean; import com.sun.star.comp.beans.SystemWindowException; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.util.CloseVetoException; public class OOoBeanExample extends JFrame { private static final long serialVersionUID = 1L; private OOoBean m_bean; public OOoBeanExample(String title) { super(title); m_bean = new com.sun.star.comp.beans.OOoBean(); add(m_bean, BorderLayout.CENTER); setBounds(0, 0, 800, 600); setVisible(true); try { m_bean.loadFromURL("private:factory/swriter", null); m_bean.aquireSystemWindow(); // doesn't work without this } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (CloseVetoException e) { e.printStackTrace(); } catch (NoConnectionException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SystemWindowException e) { e.printStackTrace(); } validate(); // may not be necessary } public void stop () { setVisible(false); m_bean.stopOOoConnection(); } private static void createAndShowGUI() { final OOoBeanExample frame = new OOoBeanExample("OOoBean example"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { frame.stop(); System.exit(0); } }); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
yes, when I have original jars path in classpath (jars are in OFFICE_HOME/program/classes) I suppose the classloader used by com.sun.star.loader.Loader needs to be extended so that its getResource method finds the executable. Add the OOoBean to the panel as you would do with every other component. For example: m_bean = new com.sun.star.comp.beans.OOoBean(); add(m_bean, BorderLayout.CENTER); pack(); setBounds(x, y, width, height); setVisible(true); m_bean.loadFromURL("private:factory/swriter", null); validate(); //may not be necessary --Joachim I try your suggestion, but I have any adding : after loadFromURL , I have to add aquireSystemWindow(). Panel must be in frame before aquireSystemWindow This is simple example - it work for SAL_USE_VCLPLUGIN=kde (I isn't important what I use : kde or gnome - it work only for kde) I try gtk 2.4.14,2.8.3,2.8.4 without success - frame is open, there isn't exception or error but office isn't in frame (I have empty frame - background color is from gnome) I try with java.awt.Frame instead javax.swing.JFrame - it is same That's unfortunate. I cannot tell you right now, what's wrong here. This needs some further investigation. Thanks, Joachim Thanks Haris Peco example : package firststeps; import java.awt.BorderLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import javax.swing.JFrame; import com.sun.star.comp.beans.NoConnectionException; import com.sun.star.comp.beans.OOoBean; import com.sun.star.comp.beans.SystemWindowException; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.util.CloseVetoException; public class OOoBeanExample extends JFrame { private static final long serialVersionUID = 1L; private OOoBean m_bean; public OOoBeanExample(String title) { super(title); m_bean = new com.sun.star.comp.beans.OOoBean(); add(m_bean, BorderLayout.CENTER); setBounds(0, 0, 800, 600); setVisible(true); try { m_bean.loadFromURL("private:factory/swriter", null); m_bean.aquireSystemWindow(); // doesn't work without this } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (CloseVetoException e) { e.printStackTrace(); } catch (NoConnectionException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SystemWindowException e) { e.printStackTrace(); } validate(); // may not be necessary } public void stop () { setVisible(false); m_bean.stopOOoConnection(); } private static void createAndShowGUI() { final OOoBeanExample frame = new OOoBeanExample("OOoBean example"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { frame.stop(); System.exit(0); } }); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
Hello, On Friday 30 September 2005 06:30 am, Joachim Lingner wrote: > > I try with java.awt.Frame instead javax.swing.JFrame - it is same > That's unfortunate. I cannot tell you right now, what's wrong here. This > needs some further investigation. > I try with examples from odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment (from source) - I use NativeView and DocumentView and get office document in Frame (doesn't work with original Desk.java example) - it is Frame from eclipse pattern for embed Swing/Awt in SWT - Office document has been showed when I pack shell again and open document after this again (pack shell again is bug from eclipse 3.1 for gtk. I suppose, but reopen document is problem with OO) - document is showed, but resizing doesn't work I can send source for this, if you want (I change NativeView - have to load 2 native libraries) Thanks Haris Peco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] OO2 130 and OfficeBean
Many thanks for the example. We will try to reproduce this issue and submit an issue if necessary. Joachim snpe wrote: On Friday 30 September 2005 03:21 pm, Joachim Lingner wrote: I am not sure if I understand. Does the example odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment work or not? work same in gtk and kde - resizing (for example, maximizing windows doesn't work correct in gtk, only) Previous (OOoBeanExample) work perfect on kde. I cannot say what happens when one uses OOoBean with that special eclipse frame. Anyway, the general problem with gtk should be reproducable with you previous example. If you like, you can submit an issue and attach your previous example (should be complete and runnable), so we can later reproduce this bug. eclipse frame work like awt frame, but it isn't important.I make example with JFrame zip is in attach.You have to do next for execute (this is ugly, but it is for test only and I know that I can use classloader) : -Djava.library.path=$OFFICE_HOME/program This is for loading libraries libnativeview.so - don't use classloader, compiled on rh 8.0 gcc 3.2 - changed packagge name form original only move libnativeview.so in $OFFICE_HOME/program set jars juh.jar,jurt.jar,ridl.jar and unoil.jar in classpath (or import eclipse project) Start class ooffice.test.Main I work with jdk 1.5.0 update 5 (I try and with mustang b53 and it is same) My results : - work fine with kde (open, resizing etc - it isn't necesary open OO document twice) - gtk open document fine , but I have to call openDocument twice (commented in Main.java) resizing doesn't work (try maximize frame) It work same with Frame instead JFrame Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]