java - Eclipse RCP 中的 EditorApp_1.0.0.qualifier 找不到 com.app.application.Application

标签 java eclipse-plugin eclipse-rcp rcp

我有一个如下所示的 RCP 应用程序。

list .MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: EditorApp
Bundle-SymbolicName: EditorApp;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: EditorApp.Activator
Bundle-Vendor: APP
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 com.ibm.icu,
 org.eclipse.jface.databinding,
 org.eclipse.core.databinding.property,
 org.eclipse.core.databinding.observable,
 org.eclipse.core.databinding.beans,
 org.eclipse.core.databinding,
 org.eclipse.core.resources;bundle-version="3.9.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: /Lib/mariadb-java-client-1.2.3.jar .
Export-Package: com.app.editor;
  uses:="org.osgi.framework,
   org.eclipse.ui,
   org.eclipse.jface.action,
   org.eclipse.equinox.app,
   org.eclipse.jface.resource,
   org.eclipse.ui.application,
   org.eclipse.ui.plugin",
 com.app.editor.actions;uses:="org.eclipse.jface.action",
 com.app.editor.beans,
 com.app.editor.functionalities;
  uses:="org.eclipse.swt.graphics,
   org.eclipse.swt.widgets,
   org.eclipse.jface.dialogs,
   javax.swing.tree",
 com.app.editor.handlers;uses:="org.eclipse.core.commands",
 com.app.editor.perspectives;uses:="org.eclipse.ui",
 com.app.editor.views;
  uses:="com.app.editor.beans,
   org.eclipse.swt.widgets,
   org.eclipse.swt.custom,
   com.app.editor.functionalities,
   org.eclipse.core.databinding,
   org.eclipse.jface.viewers,
   org.eclipse.ui.part"

插件.xml

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="com.app.application.Application">
         </run>
      </application>
   </extension>
   <extension
         point="org.eclipse.ui.perspectives">
      <perspective
            name="RCP Perspective"
            class="com.app.editor.perspectives.Perspective"
            id="com.app.Editor.perspective">
      </perspective>
      <perspective
            class="com.app.editor.perspectives.NewFilePerspective"
            id="com.app.Editor.newFileperspective"
            name="New File Prespective">
      </perspective>
      <perspective
            class="com.app.editor.perspectives.OpenFilePerspective"
            id="com.app.Editor.openFileperspective"
            name="Open File Perspective">
      </perspective>
      <perspective
            class="com.app.editor.perspectives.CloseViewPerspective"
            id="com.app.Editor.closeViewperspective"
            name="Close View Prespective">
      </perspective>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="com.app.editor.handlers.NewFileHandler"
            id="com.app.Editor.New"
            name="New">
      </command>
      <command
            defaultHandler="com.app.editor.handlers.OpenHandler"
            id="com.app.Editor.Open"
            name="Open">
      </command>
      <command
            defaultHandler="com.app.editor.handlers.ExitHandler"
            id="com.app.Editor.commands.Exit"
            name="Exit">
      </command>
      <command
            defaultHandler="com.app.editor.handlers.CloseHandler"
            id="com.app.Editor.close"
            name="Close">
      </command>
      <command
            defaultHandler="com.app.editor.handlers.AboutHandler"
            description="About"
            id="com.app.Editor.about"
            name="About">
      </command>
      <command
            defaultHandler="com.app.editor.handlers.SaveHandler"
            id="com.app.Editor.Save"
            name="Save">
      </command>
      <command
            defaultHandler="com.app.editor.handlers.SaveAsHandler"
            id="com.app.Editor.SaveAs"
            name="Save As..">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="menu:org.eclipse.ui.main.menu">
         <menu
               id="fileMenu"
               label="File">
            <command
                  commandId="com.app.Editor.New"
                  label="New"
                  style="push">
            </command>
            <command
                  commandId="com.app.Editor.Open"
                  label="Open"
                  style="push">
            </command>
            <command
                  commandId="com.app.Editor.Save"
                  label="Save"
                  style="push">
            </command>
            <command
                  commandId="com.app.Editor.SaveAs"
                  label="Save As.."
                  style="push">
            </command>
            <command
                  commandId="com.app.Editor.close"
                  label="Close"
                  style="push">
            </command>
            <command
                  commandId="com.app.Editor.commands.Exit"
                  label="Exit"
                  style="push">
            </command>
         </menu>
         <menu
               id="helpMenu"
               label="Help">
            <command
                  commandId="com.app.Editor.about"
                  label="About"
                  style="push">
            </command>
         </menu>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.views">
      <view
            class="com.app.editor.views.OpenView"
            id="com.app.Editor.openView"
            name="OpenView"
            restorable="true">
      </view>
      <view
            class="com.app.editor.views.CloseView"
            id="com.app.Editor.closeView"
            name="CloseView"
            restorable="true">
      </view>
      <view
            allowMultiple="false"
            class="com.app.editor.views.NewView"
            id="com.app.Editor.newView"
            name="NewView"
            restorable="true">
      </view>
      <view
            class="com.app.editor.views.TreeView"
            id="com.app.Editor.treeView"
            name="TreeView"
            restorable="true">
      </view>
   </extension>
   <extension
         point="org.eclipse.ui.bindings">
   </extension>
</plugin>

构建.属性

output.. = bin/
bin.includes = plugin.xml,\
               META-INF/,\
               library/,\
               library/mariadb-java-client-1.2.3.jar

扩展点。

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="com.app.application.Application">
         </run>
      </application>
   </extension>

但是,当我尝试运行此代码时,出现错误 -

!SESSION 2016-01-05 15:57:41.080 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_45
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -application EditorApp.application
Command-line arguments:  -application EditorApp.application -data C:\Srijani\Personal Workspace\RCP/../runtime-EditorApp.application -dev file:C:/Srijani/Personal Workspace/RCP/.metadata/.plugins/org.eclipse.pde.core/EditorApp.application/dev.properties -debug C:\Srijani\Personal Workspace\RCP\.metadata\.plugins\org.eclipse.pde.core\EditorApp.application/.options -os win32 -ws win32 -arch x86 -consoleLog

!ENTRY org.eclipse.osgi 2 0 2016-01-05 15:57:42.378
!MESSAGE com.app.application.Application cannot be found by EditorApp_1.0.0.qualifier
!STACK 0
java.lang.ClassNotFoundException: com.app.application.Application cannot be found by EditorApp_1.0.0.qualifier
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:568)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:191)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

!ENTRY org.eclipse.osgi 4 0 2016-01-05 15:57:42.378
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in EditorApp was unable to load class com.app.application.Application.
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:176)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:191)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.ClassNotFoundException: com.app.application.Application cannot be found by EditorApp_1.0.0.qualifier
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:568)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
    ... 16 more

正如您已经看到的,com.app.application.Application 类是此应用程序 EditorApp 的入门级类,并且它确实存在。但是,不知何故,应用程序在运行时无法找到它。

这有什么可能的原因吗?该类是否有可能在调用之前没有被加载?如果是这样,我该如何处理?

我正在使用 Jdk 64 位和 Eclipse Luna。

注意:更新了 list

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: EditorApp
Bundle-SymbolicName: EditorApp;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: APP
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 com.ibm.icu,
 org.eclipse.jface.databinding,
 org.eclipse.core.databinding.property,
 org.eclipse.core.databinding.observable,
 org.eclipse.core.databinding.beans,
 org.eclipse.core.databinding,
 org.eclipse.core.resources;bundle-version="3.9.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
 library/mariadb-java-client-1.2.3.jar
Export-Package: com.app.editor;
  uses:="org.osgi.framework,
   org.eclipse.ui,
   org.eclipse.jface.action,
   org.eclipse.equinox.app,
   org.eclipse.jface.resource,
   org.eclipse.ui.application,
   org.eclipse.ui.plugin",
 com.app.editor.actions;uses:="org.eclipse.jface.action",
 com.app.editor.beans,
 com.app.editor.functionalities;
  uses:="org.eclipse.swt.graphics,
   org.eclipse.swt.widgets,
   org.eclipse.jface.dialogs,
   javax.swing.tree",
 com.app.editor.handlers;uses:="org.eclipse.core.commands",
 com.app.editor.perspectives;uses:="org.eclipse.ui",
 com.app.editor.views;
  uses:="com.app.editor.beans,
   org.eclipse.swt.widgets,
   org.eclipse.swt.custom,
   com.app.editor.functionalities,
   org.eclipse.core.databinding,
   org.eclipse.jface.viewers,
   org.eclipse.ui.part"

最佳答案

MANIFEST.MF 中的 Bundle-Classpath 条目看起来错误。条目应以逗号分隔。它应该看起来像:

Bundle-ClassPath: .,
 lib/jogg-0.0.7.jar,
 lib/jorbis-0.0.15.jar,
 lib/vorbisspi1.0.2.jar

使用 MANIFEST.MF 编辑器“运行时”选项卡上的“类路径”部分进行设置。

您的build.properties应在包含列表中列出Lib/mariadb-java-client-1.2.3.jar,否则该jar将不会被包含在插件中。

您的插件激活器实际上称为EditorApp.Activator吗?如果不存在,请修复激活器包(或不指定激活器)。

关于java - Eclipse RCP 中的 EditorApp_1.0.0.qualifier 找不到 com.app.application.Application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34614718/

相关文章:

java - Eclipse JAD 结果

java - 绕过登录屏幕

java - 生成随机数,如果相加等于指定数字

java - 是否存在结构不同但做类似事情的方法的设计模式?

java - PMD 与 Eclipse Kepler

即使有足够的可用 RAM,也会出现 java.lang.OutOfMemoryError

java - 使用 Cucumber 时 Spring Boot 在嵌入式 Cassandra 之前加载,如何解决此问题?

java - 如何让 Stripe Checkout 在 Android WebView 中继续进行?

eclipse - 删除文本编辑器注释类型

ant - 如何使用 jenkins 上的 ant 从 .product 构建 eclipse rcp 应用程序