3

I'm trying to export a Eclipse plug-in. It is just one Eclipse view I have created from the example over here: http://help.eclipse.org/mars/index.jsp?nav=%2F2_0

While the plugin runs fine, I get the following error on export (as deployable plug-ins and fragments):

# 12/15/15 8:58:14 AM CET
# Eclipse Compiler for Java(TM) v20150902-1521, 3.11.1, Copyright IBM Corp         2000, 2015. All rights reserved.
----------
1. ERROR in C:\temp\[...].java (at line 22)
    import javafx.embed.swt.FXCanvas;
           ^^^^^^^^^^^^^^^^
The import javafx.embed.swt cannot be resolved

I have tried to resolve this by adding the javafx.embed.swt to the imported packages in the MANIFEST.MF, but that didn't help. Also I have checked the Plugin Dependencies of the project and the jfxswt.jar is listed there.

In the mean time i was able to export via a feature and update site project, but the error remains. I can open the view, but it doesn't show anything. On closing the view a null pointer exception is shown. Viewing the log this is caused still by the missing java.embed.swt.

!ENTRY org.eclipse.equinox.event 4 0 2015-12-15 12:25:48.193
!MESSAGE Exception while dispatching event org.osgi.service.event.Event    [topic=org/eclipse/e4/ui/model/ui/UIElement/toBeRendered/SET]     {ChangedElement=org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@1ac3a    6f (elementId: com.[...].View, tags: [View,      categoryTag:[...]Tools Category], contributorURI: null) (widget:      ContributedPartRenderer$2 {}, renderer:       org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer@1dc9aba0,     toBeRendered: true, onTop: false, visible: true, containerData: null,     accessibilityPhrase: null) (contributionURI:    bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.   CompatibilityView, object: null, context: PartImpl     (com.[...].View) Context, variables: [], label: [...]Graph, iconURI: platform:/plugin/com.[...]/icons/sample.gif, tooltip: , dirty: false, closeable: true, description: null), Widget=null, AttName=toBeRendered, NewValue=true, EventType=SET, OldValue=false} to handler org.eclipse.e4.core.di.internal.extensions.EventObjectSupplier$DIEventHandler@12e9e909
!STACK 0
java.lang.Error: Unresolved compilation problems: 
The import javafx.embed.swt cannot be resolved
FXCanvas cannot be resolved to a type
FXCanvas cannot be resolved to a type
FXCanvas cannot be resolved to a type
FXCanvas cannot be resolved to a type

at com.[...].View.<init>([...]View.java:22)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:184)
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.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:58)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:101)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:279)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:317)
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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:898)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:879)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:121)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:345)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:264)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:104)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:73)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:55)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:971)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:640)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:746)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:717)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:711)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:695)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.subscribeTopicToBeRendered(PartRenderingEngine.java:142)
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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.di.internal.extensions.EventObjectSupplier$DIEventHandler.handleEvent(EventObjectSupplier.java:83)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:85)
at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:59)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.e4.ui.model.application.ui.impl.UIElementImpl.setToBeRendered(UIElementImpl.java:303)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:489)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:458)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:724)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:701)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:639)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:634)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1157)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1140)
at org.eclipse.ui.handlers.ShowViewHandler.openOther(ShowViewHandler.java:102)
at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHandler.java:75)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:252)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:234)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:493)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:486)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:343)
at org.eclipse.ui.internal.ShowViewMenu$3.run(ShowViewMenu.java:147)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
Robert Graf
  • 31
  • 1
  • 3
  • Did you try to export it as described here? http://stackoverflow.com/questions/12624603/how-to-export-an-eclipse-plugin-with-dependencies – Chris K. Dec 15 '15 at 08:26
  • That worked, somehow. I have installed the Feature, now Eclipse doesn't start anymore, because of a java.lang.NullPointerException. – Robert Graf Dec 15 '15 at 09:39
  • Sounds like it didn't work at all? – Chris K. Dec 15 '15 at 09:55
  • I removed my .metadata folder, now Eclipse does start again and the View is there. However, it is empty. Seems it doesn't start the same way as if i start it via the project. – Robert Graf Dec 15 '15 at 10:12
  • Are there any exceptions or any other information? – Chris K. Dec 15 '15 at 10:21
  • When I try to close the empty View there is a java.lang.NullPointerException. However this does not happen when i start the View via the UpdateSite project. – Robert Graf Dec 15 '15 at 10:24
  • Could you update your question with the new information won and add the complete NullPointerException? Maybe there is some useful information in there e.g. missing dependency – Chris K. Dec 15 '15 at 10:37
  • still looks like your dependencies cannot be resolved: "import javafx.embed.swt cannot be resolved" this can have several reasons but because you seem to have checked that the dependency is packaged i guess it is a classpath issue.. do you have any options there? – Chris K. Dec 15 '15 at 12:29
  • were you able to fix your problem? – Chris K. Dec 21 '15 at 09:40

3 Answers3

3

For me it helped to add jfxswt.jar to the Runtime classpath.

A related article: javafx package javafx.embed.swt not in java8u5

enter image description here

Community
  • 1
  • 1
Stefan
  • 10,010
  • 7
  • 61
  • 117
2

In Neon, after installing e(fx)clipse, I had to add the jar file manually to make it work (experienced this now multiple times, both on Linux (Ubuntu) and OSX).

LuFFy
  • 8,799
  • 10
  • 41
  • 59
Lorenz
  • 45
  • 1
  • 6
1

Go to Window > Preferences > Java > Installed JREs Select the JRE that is used in your project Choose Edit then copy the "JRE home path" and click Add External JARs... the navigate to the path copied (e.g. /usr/lib/jvm/java-8-openjdk-amd64) then to jre/(if it is an jdk)lib folder and select jfxswt.jar (on OSX /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre/lib/jfxswt.jar). Then Finish and Apply, Eclipse will rebuild your project and add the jar to the "JRE System Library".

This has the advantage that you do not need to modify all your projects.

Lorenz
  • 45
  • 1
  • 6