Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从applet启动OpenOffice_Java_Applet_Openoffice.org - Fatal编程技术网

Java 从applet启动OpenOffice

Java 从applet启动OpenOffice,java,applet,openoffice.org,Java,Applet,Openoffice.org,我有这个代码下来,这从命令行工作良好。。。 但当我把它放入applet时,我得到了以下错误 com.sun.star.lang.IllegalArgumentException 在com.sun.star.comp.bridgefactory.bridgefactory.createBridge上(bridgefactory.java:158) 在 com.sun.star.comp.urlsolver.urlsolver$\u urlsolver.resolve(urlsolver.java:

我有这个代码下来,这从命令行工作良好。。。 但当我把它放入applet时,我得到了以下错误

com.sun.star.lang.IllegalArgumentException 在com.sun.star.comp.bridgefactory.bridgefactory.createBridge上(bridgefactory.java:158) 在 com.sun.star.comp.urlsolver.urlsolver$\u urlsolver.resolve(urlsolver.java:130)

有人能解决这个问题吗?我在哪里可以找到BridgeFactory的来源

   Runtime.getRuntime().exec("C:/Program Files/OpenOffice.org 3/program/soffice.exe -accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"); // oooUrlW - the url of soffice.exe
              Thread.sleep(5000);

              XComponentContext xLocalContext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
              XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
              Object urlResolver  = xLocalServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",xLocalContext);
              XUnoUrlResolver xUnoUrlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class,urlResolver);

              Object initialObject = xUnoUrlResolver.resolve("uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager");
              XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,initialObject);
              XComponentContext remoteContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, xPropertySet.getPropertyValue("DefaultContext"));

              XMultiComponentFactory remoteServiceManager = remoteContext.getServiceManager();
              Object desktop = remoteServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", remoteContext);

                 xDesktop =(XDesktop) UnoRuntime.queryInterface( XDesktop.class, desktop);
 XComponent xCalcComponent =
           newDocComponent(xDesktop, "scalc");
           XSpreadsheetDocument xCalcDocument =
                      (XSpreadsheetDocument)UnoRuntime.queryInterface(
                                           XSpreadsheetDocument.class, xCalcComponent);
           XSpreadsheets a=xCalcDocument.getSheets();
           Object o = a.getByName("Sheet1");

           XSpreadsheet sheet = (XSpreadsheet)UnoRuntime.queryInterface(
                    XSpreadsheet.class, o);


           XCell jjjj = sheet.getCellByPosition(0, 0);
           jjjj.setFormula("Some Text ");

小程序是否已签名?否则我想你不能打电话了

Runtime.getRuntime().exec("C:/Program Files/OpenOffice.org 3/program/soffice.exe-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager");

从一个小程序。

我同意皮埃尔的看法。。。您需要一个受信任/已签名的小程序来执行此操作。您可能还想重新考虑一下,为什么要用小程序而不是独立的应用程序(如果需要web交付,可以使用webstart或其他东西)来实现这一点

另一件要考虑的是,最终用户必须在本地安装OpenOffice(除非他们改变了API的工作方式),以便任何java OO。这个要求可能已经改变了,我已经有一段时间没有使用他们的API了


祝你好运,我希望这能帮上一点忙。

它已经签署,我找到了一种解决方案——我同意在客户机上
permission java.security.AllPermission现在一切都正常了。。。
我仍然没有尝试授予“MyCompany”签名的权限java.securyty.AllPermission
我必须这么做

错误信息误导了我 com.sun.star.lang.IllegalArgumentException。。。愚蠢的信息

我必须使用小程序。。。这是Oracle表单应用程序,我需要在客户端启动Calc并填充一些数据


感谢您的帮助。

有一种非常简单的方法可以将OOo放置在小程序中-使用

虽然java安全性仍然存在问题,但代码将更加紧凑。我们用这个做同样的事情。我关于如何让OO3.2在Java6小程序中工作的帖子是,您想看看。它适用于3.1和3.2