Page 1 of 1

UNO_PATH environment variable is not set

Posted: Tue Jun 09, 2009 4:21 pm
by deadhorus
Hello everyone!

This is my first post on this forum, so try not to be too sharp on me...
I am trying to implement an application using OfficeBean under linux. Currently I'm using a Slackware box, with a standard installation of OpenOffice3.0.1. The OpenOffice SDK is installed too, under the standard path.

My problem is that everytime I call aBean.aquireSystemWindow(), it raises a strange exception:

Code: Select all

java.lang.Exception: 
java.io.IOException: UNO_PATH environment variable is not set (required system path to the office program directory)
java.io.IOException: UNO_PATH environment variable is not set (required system path to the office program directory)
        at com.sun.star.comp.beans.LocalOfficeConnection$OfficeService.startupService(LocalOfficeConnection.java:774)
        at com.sun.star.comp.beans.LocalOfficeConnection.connect(LocalOfficeConnection.java:336)
        at com.sun.star.comp.beans.LocalOfficeConnection.getComponentContext(LocalOfficeConnection.java:240)
        at com.sun.star.comp.beans.OOoBean.setOOoConnection(OOoBean.java:183)
        at com.sun.star.comp.beans.OOoBean.getOOoConnection(OOoBean.java:283)
        at com.sun.star.comp.beans.OOoBean.getMultiServiceFactory(OOoBean.java:303)
        at com.sun.star.comp.beans.OOoBean.loadFromURL(OOoBean.java:573)
        at openofficeintegration.OpenOfficeIntegrationView.jMenuItem1ActionPerformed(OpenOfficeIntegrationView.java:227)
        at openofficeintegration.OpenOfficeIntegrationView.access$900(OpenOfficeIntegrationView.java:28)
        at openofficeintegration.OpenOfficeIntegrationView$5.actionPerformed(OpenOfficeIntegrationView.java:150)
--- end.
I also want to specify that the environment variable UNO_PATH is set and it points to the correct directory. If I issue from a shell echo $UNO_PATH the result is:

Code: Select all

echo $UNO_PATH
/opt/openoffice.org3/program
In change System.getenv("UNO_PATH") keeps returning null.

The code in question is:

Code: Select all

System.out.println("binding open office");
        OOoBean aBean = new OOoBean();
        mainPanel.add(aBean);
        aBean.setVisible(true);

        // attempt to create a new document
        String url = "/tmp/doc1.odt";
        try{
            aBean.loadFromURL(url, null);
            aBean.aquireSystemWindow();
        } catch (SystemWindowException e) {
            //System.out.println(e.toString());
            System.out.println("Exceptie SystemWindow");
        } catch (NoConnectionException e) {
            System.out.println("Exceptie NoConnection");
        } catch (Exception e) {
            System.out.println("Exceptie generica");
        }
You have any suggestion on this problem?

Thanks in advance and have a nice day.