所以我有这个从 OpenOffice 文档到另一个 OpenOffice 文档(电子表格)的无意识复制粘贴任务。我认为这将是一个很好的机会,可以节省时间并做一些很酷的事情,并编写一个小程序来为我完成所有的复制和粘贴(这是一个巨大的数量)。
所以我发现 OpenOffice 有这个 API/SDK 来做这种事情。似乎它只适用于 Java 1.5/1.6 和 Netbeans 6.7 或更早版本,以及 Eclipse。因为他们有一个为 Netbeans 构建的插件,所以我安装了 Netbeans 6.7 和他们的在线指南 ( http://wiki.openoffice.org/wiki/OpenOffice_NetBeans_Integration ) 之后的插件。
我几乎可以创建一个新的 OpenOffice 项目并开始并感到高兴,但每次尝试创建该项目时,Netbeans 中都会出现某种 Java 错误。
我得到的确切错误是:
java.lang.NullPointerException
at org.openoffice.extensions.config.LibraryManager.getLibraryName(LibraryManager.java:176)
at org.openoffice.extensions.config.ConfigurationSettings.getLibraryName(ConfigurationSettings.java:280)
at org.openoffice.extensions.util.ProjectCreator.updateWizardDescriptor(ProjectCreator.java:219)
at org.openoffice.extensions.util.ProjectCreator.createAddon(ProjectCreator.java:170)
at org.openoffice.extensions.projecttemplates.addon.AddOnWizardIterator.instantiate(AddOnWizardIterator.java:146)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1018)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:588)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:409)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:248)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:161)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1527)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1481)
at org.openide.WizardDescriptor.access$1700(WizardDescriptor.java:127)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2052)
at org.openide.WizardDescriptor$Listener$2.run(WizardDescriptor.java:2101)
at org.openide.WizardDescriptor$7.run(WizardDescriptor.java:1413)
at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1453)
at org.openide.WizardDescriptor.access$1300(WizardDescriptor.java:127)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2108)
at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:451)
at com.sun.proxy.$Proxy8.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6414)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
at java.awt.Component.processEvent(Component.java:6179)
at java.awt.Container.processEvent(Container.java:2083)
at java.awt.Component.dispatchEventImpl(Component.java:4776)
at java.awt.Container.dispatchEventImpl(Container.java:2141)
at java.awt.Component.dispatchEvent(Component.java:4604)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4280)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
at java.awt.Container.dispatchEventImpl(Container.java:2127)
at java.awt.Window.dispatchEventImpl(Window.java:2489)
at java.awt.Component.dispatchEvent(Component.java:4604)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:690)
at java.awt.EventQueue$3.run(EventQueue.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:205)
at java.awt.Dialog$1.run(Dialog.java:1049)
at java.awt.Dialog$3.run(Dialog.java:1101)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1099)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:985)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1019)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1007)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:115)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1355)
at org.openide.util.Mutex.readAccess(Mutex.java:268)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:992)
at java.awt.Component.show(Component.java:1615)
at java.awt.Component.setVisible(Component.java:1567)
at java.awt.Window.setVisible(Window.java:843)
at java.awt.Dialog.setVisible(Dialog.java:984)
at org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:495)
at org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:362)
[catch] at org.netbeans.modules.project.ui.actions.NewProject$2.run(NewProject.java:139)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
看到 NULL 指针和对配置扩展的引用(OpenOffice 的东西),我发现有些东西设置不正确。我想不通的是——我错过了什么?我的 Mac 设置为使用 Java 1.6,可通过终端识别并且不会在其他任何地方造成错误。Netbeans 工作正常,插件已安装,并表明我链接的 OpenOffice 安装和 SDK 源代码都很好。
有没有人偶然使用过这个 API 或者知道我缺少什么?
任何帮助将不胜感激,谢谢!
编辑 Netbeans 在我考虑报告它时给了我一个不同的总结,我在上面嵌入的是“细节”:
A java.lang.ArrayIndexOutOfBoundsException exception has occurred.
Please report this at http://www.netbeans.org/community/issues.html,
including a copy of your messages.log file as an attachment.
The messages.log file is located in your /Users/bailey/.netbeans/6.7/var/log folder.