I know there are other questions on the subject but I' ve tried them all and didn' t work for me. I want to write some output to excel files from my rcp plug in but it shows:
java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
So I do: plugin.xml->runtime tab-> add the poi jars in the classpath section.
But then when i try to run, it shows:
org.osgi.framework.BundleException: The activator spyros.getInfo.Activator for
bundle spyros.getInfo is invalid.
My questions:
Do i have to put the poi jars in a specific folder (example in META-INF folder) and then add them to classpath?
How can i fix the activator error?
My 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
My build properties
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
My 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>
I am so confused, but i am sure that stackoverflow community will help, because you are the best! Thanx in advance!
This is because of:
There has been a ClassNotFoundException trying to load the class in the first place, before it's even got to the start() method.
So for solve this problem:
You have to add . in to your class path see following image.
Add scr as source in your build and . in your bin.includes. See the image below:
Related
I am new to Eclipse plugin development. Recently, I downloaded a completed source code of an Eclipse plugin from another team. The popup menu of the plugin is not visible, so I just created a simple popup-menu-command for testing.
In the project, I only changed the plugin.xml to :
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<command
description="some description"
id="com.something.aCommand"
name="somet name">
</command>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
<command commandId="com.something.aCommand"
label="Create HTML" style="push">
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="com.something.aHandler"
commandId="com.something.aCommand">
</handler>
</extension>
</plugin>
(The aCommand and aHandler are nicknames of the real command and handler which do exist)
This sample is similar to the example here http://www.vogella.com/tutorials/EclipsePlugin/article.html#extending-the-eclipse-ide
And I tested it by Run as-> Eclipse Appliication, the right-click-pupup-command "Create HTML" is not visible.
Besides, this project does not contain fragment.e4mi file, does this mean it is a Eclipse 3 plug-in ? Because I find almost all eclipse plug-in tutorials are using fragment.e4mi and the e4 model fragment UI.
Environment:
Windows 10 64-bits
Eclipse Oxygen.1a Release (4.7.1a)
This is basically OK but is only contributing to the Package Explorer view (id org.eclipse.jdt.ui.PackageExplorer)
For Project Explorer to context menu id is org.eclipse.ui.navigator.ProjectExplorer#PopupMenu.
You can also use popup:org.eclipse.ui.popup.any to contribute to any menu.
I'm writing 2 eclipse plugins: xx.launching and xx.ui
I wrote a custom debug configuration. When I open Debug Configuration manager, I can see my new configuration "MyConfiguration". But when I try to add a new configuration of MyConfiguration I receive an Error:
Plug-in xx.ui was unable to load class xx.ui.launcher.MyApplicationTabGroup
In my plugin.xml of my plugins xx.launching and xx.ui I have this lines:
xx.launching
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
delegate="xx.launching.MyApplicationLaunchConfigurationDelegate"
id="xx.launching.MyApplication"
modes="debug"
...>
</launchConfigurationType>
...
</extension>
xx.ui
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
type="xx.launching.MyApplication"
class="xx.ui.launcher.MyApplicationTabGroup"
...>
</launchConfigurationTabGroup>
...
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
icon="$nl$/icons/my.gif"
configTypeID="xx.launching.MyApplication"
...>
</launchConfigurationTypeImage>
..
</extension>
Class xx.ui.launcher.MyApplicationTabGroup really exists
I really can see this icon in Debug Configurations list
What did I wrong?
Many thanks in advance!
I am using org.eclipse.ui.activities to remove certain context menu entries.
I was successful in removing
Team, Show in Remote Systems View, Restore From Local History
by using the below in my plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.ui.activities">
<activity description="Disable Menu/Context Menu Contributions"
id="com.myapp.myactivity" name="MyViewActivity">
</activity>
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org.eclipse.team.*"/>
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org.eclipse.rse.*"/>
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org.eclipse.compare.*"/>
</extension>
</plugin>
I need to remove the "Profile As" , "Source" , "Configure" entries. I've used plugin spy of eclipse and was able to get the associated class and it's plugin jar like for e.x
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org\.eclipse\.ui\.workbench/org\.eclipse\.jst\.servlet\.ui\.internal\.actions\.ConvertToWebModuleTypeAction"/>
for Removing Configure->Convert To Dynamic Web Project Entry in the context menu but this doesn't work. Am I missing something here?
From Plugin Spy
The active contribution item identifier:
convertToWebModuleTypeAction
The active contribution location URI:
menu:org.eclipse.ui.projectConfigure?after=convertToWebModuleTypeAction
The active contribution item class:
ConvertToWebModuleTypeAction
The contributing plug-in:
org.eclipse.ui.workbench (3.7.1.v20120104-1859)
Any Help to remove the entries above (i.e Profile As, Source, Configure) will be really appreciated.
How to convert plugin.xml file to manifest.mf file as some tags like:
<runtime>
<library name="aaa.jar">
<export name="*"/>
</library>
<runtime>
are seems to be ignored.
Here is some correspondence in the next document, but far from complete reference.
http://www.eclipse.org/eclipse/platform-core/runtime/adoption.html
Open the file in the plugin.xml editor. On the Overview Tab>Plug-in Content section there should be a link, "..., create an OSGi manifest"
The OSGi manifest is a set of headers describing the bundle, the bundles or packages that are dependencies, and the packages this bundle exports. ex:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse UI Tests
Bundle-SymbolicName: org.eclipse.ui.tests; singleton:=true
Bundle-Version: 3.6.0.qualifier
Bundle-ClassPath: uitests.jar
Bundle-Activator: org.eclipse.core.internal.compatibility.PluginActivator
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.core.runtime.compatibility,
org.eclipse.core.resources,
org.eclipse.core.expressions,
org.eclipse.ui,
...
Eclipse-AutoStart: true
Export-Package: org.eclipse.ui.tests.api,
org.eclipse.ui.tests.helpers,
org.eclipse.ui.tests.menus
Bundle-RequiredExecutionEnvironment: J2SE-1.4
I have this very unusual problem.
I developed this plugin with property page. When I run plug-in as Eclipse application it works perfectly, but when I export it and copy it to eclipse/dropin folder I get ClassNotFoundException.
My Manifest.mf looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SpectrumPlugin
Bundle-SymbolicName: sinaut.spectrum.plugin; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: sinaut.spectrum.plugin.activator.SpectrumPluginActivator
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
org.eclipse.ui;bundle-version="3.4.2",
org.eclipse.core.resources;bundle-version="3.4.2",
org.eclipse.ui.console;bundle-version="3.3.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: JARs/sshfactory.jar,
.
Import-Package: org.eclipse.ui.console
Export-Package: com.jscape.a,
sinaut.spectrum.plugin.activator,
sinaut.spectrum.plugin.ftp,
sinaut.spectrum.plugin.preferences,
sinaut.spectrum.plugin.remotebuild,
sinaut.spectrum.plugin.ssh
plugin.xml looks like this:
<plugin>
<extension
point="org.eclipse.ui.preferencePages">
<page
id="BildPreferencePage"
name="Bild Preferences"
class="sinaut.spectrum.plugin.preferences.BildPreferencePage"
>
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="sinaut.spectrum.plugin.preferences.PreferenceInitializer">
</initializer>
</extension>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
id="sinaut.spectrum.plugin.RemoteBildActionSet"
label="RemoteBildActionSet"
visible="true">
<menu
id="sinaut.spectrum.plugin.RemoteBuildMenu"
label="Remote Build Menu">
<groupMarker
name="content">
</groupMarker>
<separator
name="additions">
</separator>
</menu>
<action
class="sinaut.spectrum.plugin.remotebuild.RemoteBuild"
icon="/icons/rb.gif"
id="sinaut.spectrum.plugin.RemoteBuild"
label="Remote Build"
state="true"
style="push"
toolbarPath="Normal/additions">
</action>
</actionSet>
</extension>
</plugin>
And I've got this message when I try to start this property page "Unable to create the selected preference page.sinaut.spectrum.plugin.preferences.BildPreferencePage", with this stack trace:
java.lang.ClassNotFoundException: sinaut.spectrum.plugin.preferences.BildPreferencePage
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:483)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:315)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1274)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:867)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode.createPage(WorkbenchPreferenceNode.java:47)
at org.eclipse.jface.preference.PreferenceDialog.createPage(PreferenceDialog.java:1306)
at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.createPage(FilteredPreferenceDialog.java:385)
at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1197)
at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showPage(FilteredPreferenceDialog.java:682)
at org.eclipse.jface.preference.PreferenceDialog$10.run(PreferenceDialog.java:702)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.preference.PreferenceDialog$9.selectionChanged(PreferenceDialog.java:698)
at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:842)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:840)
at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1153)
at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1178)
at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:250)
at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:244)
at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:418)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3378)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3036)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1158)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3401)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3033)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
It must be something stupid, but I just can't see it.
If anyone can help me with this. I've been stuck for hours on this.
Launch eclipse with below argument
-console
Then find your plug-in id in OSGi console like
ss sinaut.spectrum.plugin
Last using diag to see why your plug-in can't be resolved
diag <id found by ss command>
and try to start it to see whether anything is wrong in its activator
start <id>