2012-04-26 45 views
0

我知道还有其他关于这个问题的问题,但我已经试过了,并没有为我工作。我想写一些输出,从我在RCP插件Excel文件,但它显示:invalid activator

java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook 

所以我做的:plugin.xml->runtime tab-> add the poi jars in the classpath section

但后来当我尝试运行,它表明:

org.osgi.framework.BundleException: The activator spyros.getInfo.Activator for 
bundle spyros.getInfo is invalid. 

我的问题:

  1. 我一定把POI jar文件中的特定文件夹中的META-INF文件夹(例如),然后将它们添加到类路径?
  2. 我该如何解决激活器错误?

我的MANIFEST.MF

Manifest-Version: 1.0 
Bundle-ManifestVersion: 2 
Bundle-Name: GetInfo 
Bundle-SymbolicName: spyros.getInfo; singleton:=true 
Bundle-Version: 1.0.0.qualifier 
Bundle-Activator: spyros.getInfo.Activator 
Require-Bundle: org.eclipse.core.runtime, 
org.eclipse.jdt.core;bundle-version="3.7.1", 
org.eclipse.core.resources;bundle-version="3.7.100", 
org.eclipse.ui, 
org.eclipse.jdt.ui;bundle-version="3.7.1" 
Bundle-ActivationPolicy: lazy 
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 
Import-Package: org.apache.commons.collections 
Bundle-ClassPath: lib/poi-3.8-20120326.jar, 
lib/poi-examples-3.8-20120326.jar, 
lib/poi-excelant-3.8-20120326.jar, 
lib/poi-ooxml-3.8-20120326.jar, 
lib/poi-ooxml-schemas-3.8-20120326.jar, 
lib/poi-scratchpad-3.8-20120326.jar 

我的生成属性

output.. = bin/ 
bin.includes = plugin.xml,\ 
       META-INF/,\ 
       icons/,\ 
       lib/poi-3.8-20120326.jar,\ 
       lib/poi-examples-3.8-20120326.jar,\ 
       lib/poi-excelant-3.8-20120326.jar,\ 
       lib/poi-ooxml-3.8-20120326.jar,\ 
       lib/poi-ooxml-schemas-3.8-20120326.jar,\ 
       lib/poi-scratchpad-3.8-20120326.jar 

我的plugin.xml

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

    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      defaultHandler="spyros.getInfo.handlers.GetInfo" 
      id="spyros.getInfo.commands.GetInfo" 
      name="GetInfo"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.menus"> 
     <menuContribution 
      allPopups="false" 
      locationURI="menu:org.eclipse.ui.main.menu"> 
     <menu 
       id="spyros.getInfo.commands.GetInfo" 
       label="My Info"> 
      <command 
        commandId="spyros.getInfo.commands.GetInfo" 
        label="Get Info" 
        style="push" 
        tooltip="Get Info from methods"> 
      </command> 
     </menu> 
     </menuContribution> 
    </extension> 

</plugin> 

我很困惑,但我确信,社区计算器会有所帮助,因为你是最棒的!感谢提前!

+1

解决它!我在这里找到了解决方案:http://blog.chris-alex-thomas.com/2007/07/17/eclipse-activator-class-is-invalid/comment-page-1/#comment-19889 – spyros 2012-04-27 10:00:49

回答

1

这是因为:

已经有尝试加载在首位类ClassNotFoundException异常,之前它甚至到了start()方法。

因此,对于解决这个问题:

  1. 你要到下面的图片你的类路径中看到添加.

    enter image description here

  2. 在您的构建和.bin.includes添加SCR源。见下面的图片:

    enter image description here