UNO Probleme unter OSX

AOO/LO für MacOS, Solaris ...

Moderator: Moderatoren

till_fischer
Beiträge: 1
Registriert: Mo, 28.08.2006 17:43

UNO Probleme unter OSX

Beitrag von till_fischer »

Hallo,

nachdem ich nun endlich mit Hilfe dieses Artikels geschafft habe, dass ich weder Probleme habe die .jar Dateien einzubinden noch die soffice Startdatei zu finden, stiess ich auf ein neues Problem.

Wenn ich in Eclipse folgenden Connection Test debugge:

Code: Alles auswählen

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

import com.sun.star.uno.XComponentContext;

import de.myFirm.printer.util.MyBootstrap;

public class ConnectionTest {
	
	private final static String OOoBASE = "/Applications/OpenOffice.org 2.0.app/Contents/MacOS/program";
	
	public static void main(String[] args) {

		System.out.println("START");		
		
		URLClassLoader loader = null;
		URL[] jarList;
		try {
			jarList = new URL[] {
				    new File(OOoBASE).toURL()
				};
			loader = new URLClassLoader(jarList);

			System.out.println("CREATED CLASSLOADER");

		} catch (MalformedURLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
			System.out.println("error");
		}
		
		try {
			System.out.println("TRYING BOOTSTRAP");

			XComponentContext xContext =
				MyBootstrap.bootstrap(loader);
			
			System.out.println("Connected to a running office.");
			
			com.sun.star.lang.XMultiComponentFactory xMCF =
				xContext.getServiceManager();
			
			String available = (xMCF != null ? "available" : "not available");
			System.out.println("remote ServiceManager is "+available);
			
		} catch (java.lang.Exception e) {
			e.printStackTrace();
			System.out.println("error");
		} finally {
			System.out.println("ending");
			System.exit(0);
		}
	}
}
... dann bekomme ich folgenden Output:
START
CREATED CLASSLOADER
TRYING BOOTSTRAP
CE> I18N: Operating system doesn't support locale ""
CE> /Applications/OpenOffice.org 2.0.app/Contents/MacOS/program/soffice.bin X11 error: Can't open display:
CE> Set DISPLAY environment variable, use -display option
CE> or check permissions of your X-Server
CE> (See "man X" resp. "man xhost" for details)
ending
Irgendwie schafft er also nicht, OOo zu starten. Ich kann mir denken, dass das mit der Umsetzung von X11 zu tun hat bzw daran, dass es ja erst mitgestartet werden muss.

Seltsam finde ich, dass er Augenscheinlich einen Error hat (kein Sprung in catch Block, im try gehts aber auch nicht weiter) aber er trotzdem noch den finally block durchlaeuft.

Hat jemand eine Ahnung wie ich das hinbekommen kann?

Ich wuerde gerne weiter unter OSX entwicklen.

MfG
Till Fischer[/quote][/code]
edujavac
Beiträge: 1
Registriert: Fr, 09.02.2007 13:24

Probleme X11 und MacOS

Beitrag von edujavac »

Hallo!

Es tut mir leid aber ich kann nür ein bischen Deutch. Also ich möchte lieber Englisch sprechen. I hope you can undestand.

What I would like to ask you is if you have managed to solve the problem you talked about in this post. I am getting a similar error message. What I want to do is to have my Java application connected to OpenOffice via UNO. To do this I need X11 to be launched.

I am carrying out the next check to see if X11 is launched:
ps x |grep X11

If not I execute the command "/Applications/X11.app/Contents/MacOS/X11" through the Runtime.getRuntime().exec method.

So far so good. But here arises the problem. When I try to launch OpenOffice it does not find a display. As far as I know OpenOffice should be launched from the same X11 I just launched. Is there any way to do this in Java?

Thank you very much in advance.

Grüsse,

Edu
Antworten