2012-04-26 48 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