Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » FXCanvas not found during plugin export.
FXCanvas not found during plugin export. [message #1622950] Wed, 18 February 2015 21:16 Go to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Hello,

I'm writting very simple plugin using Java 8 and JavaFX (some menu and opening window after some action on this menu). When I'm running this plugin from inside Eclipse (running second instance) to check it, everything goes fine. Unfotunately when I'm trying to export this plugin, I'm getting error with info that "import javafx.embed.swt.FXCanvas cannot be resolved".

I've found in some old discussion on this forum, that there is some very ugly solution and it relies on adding jfxrt.jar and jfxswt.jar to the project and to classpath. After such operation I could export whole plugin and install it in other Eclipse. Unfortunately plugin is not working corectly. My "item" in menu appears, but when I'm trying to launch action by clicking on it, nothing happens (there is JavaFX used in this action). No error, no excepion in command line.... nothing. When I'm writting the same thing using SWT, everything works fine.

What could be a reason of such behavior ? Maybe there is some more elegant way to resolve FXCanvas import (jfswt.jar is JRE library... so maybe there is no need to include it to plugin).

I'll be appreciate for help.



[Updated on: Thu, 19 February 2015 09:30]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1623795 is a reply to message #1622950] Thu, 19 February 2015 10:27 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
I've tagged the code by sysouts:
" shell.setLayout(new FillLayout());
System.out.println("[TAG6]");
final FXCanvas canvas = new FXCanvas(shell, SWT.NONE);
System.out.println("[TAG7]");
final Scene scene = createFXScene();"

Last thing which happens is displaying "[TAG6]". There are no exceptions (I've surronded it by try/catch), no errors....nothing. Any idea what could be the reason ? Any suggestions ?... :/
Re: FXCanvas not found during plugin export. [message #1623999 is a reply to message #1623795] Thu, 19 February 2015 13:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Did you:
a) try doing a try {} catch(Throwable t) around it
b) does the target runtime you install the bundle in also having the
org.eclipse.fx.osgi fragment
c) what happens if you launch with -Defxclipse.osgi.hook.debug=true

Tom

On 19.02.15 11:27, Piotr Iksowski wrote:
> I've tagged the code by sysouts:
> " shell.setLayout(new FillLayout());
> System.out.println("[TAG6]");
> final FXCanvas canvas = new FXCanvas(shell, SWT.NONE);
> System.out.println("[TAG7]");
> final Scene scene = createFXScene();"
>
> Last thing which happens is displaying "[TAG6]". There are no exceptions
> (I've surronded it by try/catch), no errors....nothing. Any idea what
> could be the reason ? Any suggestions ?... :/
Re: FXCanvas not found during plugin export. [message #1624125 is a reply to message #1623999] Thu, 19 February 2015 15:29 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Great tips ! Thanks for the reply.

ad. a)
I got this:
java.lang.IllegalAccessError: tried to access class javafx.embed.swt.FXCanvas$1 from class javafx.embed.swt.FXCanvas
at javafx.embed.swt.FXCanvas.<init>(FXCanvas.java:161)
at samplemenuplugin.actions.SampleAction.run(SampleAction.java:85)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
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:4454)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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)

ad. b)
Yes.


ad. c)

FXClassLoader#createJREBundledClassloader - Started
FXClassLoader#createJREBundledClassloader - Assumed location (Java 8/Java 7): /usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar
FXClassLoader#createJREBundledClassloader - SWT is available use different loading strategy
FXClassLoader#createJREBundledClassloader - Searching for SWT-FX integration at /usr/lib/jvm/java-8-oracle/jre/lib/jfxswt.jar
FXClassLoader#createJREBundledClassloader - Found SWT/FX
FXClassLoader#createJREBundledClassloader - Delegate to system classloader
FXClassLoader.SWTFXClassloader#init - Primary Loader sun.misc.Launcher$ExtClassLoader@1e284d90
FXClassLoader.SWTFXClassloader#init - Lastresort Loader org.eclipse.osgi.internal.loader.EquinoxClassLoader@b5ac0c1[org.eclipse.swt:3.103.1.v20140903-1938(id=672)]
FXClassLoader#createJREBundledClassloader - Ended
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.Parent'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.layout.HBox'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.paint.Paint'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.paint.Color'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.effect.Effect'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.effect.MotionBlur'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.effect.Reflection'
[TAG1]
[TAG3]
[TAG4]
[TAG5]
[TAG6]
FXModuleClassloader#findLocalClass trying to load class 'javafx.embed.swt.FXCanvas'
FXModuleClassloader#findLocalClass - Someone is trying to load FXCanvas. Need to check for GTK3
FXModuleClassloader#findLocalClass trying to load class 'org.eclipse.swt.SWT'
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.SWT with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.SWT with last resort
FXClassLoader.SWTFXClassloader#findClass - Result org.eclipse.swt.SWT class org.eclipse.swt.SWT
FXModuleClassloader#findLocalClass - We are on GTK need to take a closer look
FXModuleClassloader#findLocalClass trying to load class 'org.eclipse.swt.internal.gtk.OS'
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.internal.gtk.OS with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.internal.gtk.OS with last resort
FXClassLoader.SWTFXClassloader#findClass - Result org.eclipse.swt.internal.gtk.OS class org.eclipse.swt.internal.gtk.OS
FXModuleClassloader#findLocalClass - We are on GTK3 - too bad need to disable JavaFX for now else we'll crash the JVM
FXModuleClassloader#findLocalClass trying to load class 'com.sun.javafx.embed.HostInterface'
FXModuleClassloader#findLocalClass trying to load class 'javafx.embed.swt.CustomTransfer'
FXClassLoader.SWTFXClassloader#findClass - Loading javafx.embed.swt.CustomTransfer with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading javafx.embed.swt.CustomTransfer with last resort
FXClassLoader.SWTFXClassloader#findClass - Even last resort was unable to load javafx.embed.swt.CustomTransfer
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.dnd.ByteArrayTransfer with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.dnd.ByteArrayTransfer with last resort
FXClassLoader.SWTFXClassloader#findClass - Result org.eclipse.swt.dnd.ByteArrayTransfer class org.eclipse.swt.dnd.ByteArrayTransfer
FXModuleClassloader#findLocalClass trying to load class 'javafx.embed.swt.FXCanvas$1'
FXClassLoader.SWTFXClassloader#findClass - Loading javafx.embed.swt.FXCanvas$1 with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading javafx.embed.swt.FXCanvas$1 with last resort
FXClassLoader.SWTFXClassloader#findClass - Even last resort was unable to load javafx.embed.swt.FXCanvas$1
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Listener with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Listener with last resort
FXClassLoader.SWTFXClassloader#findClass - Result org.eclipse.swt.widgets.Listener interface org.eclipse.swt.widgets.Listener

And this (info from (c)) showed that default SWT_GTK3 was improper. I exported SWT_GTK3=0 in console before running Eclipse and the plugin started working without any problems. So problem is partly solved.

Unfortunately I still don't know how to solve it in final version to make it automatically. There is still a need to set the environment variable by hand before installing the plugin.

Do you have any suggestions how it could be solved ?


[Updated on: Thu, 19 February 2015 15:30]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1624281 is a reply to message #1624125] Thu, 19 February 2015 17:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You'd have to modify the eclipse.ini to force it to gtk2 but i don't think there is a p2 touchpoint for that
Re: FXCanvas not found during plugin export. [message #1646025 is a reply to message #1624281] Mon, 02 March 2015 20:33 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Thanks for reply. Do you (or anybody from forum participants) maybe know if there is possibility to run plugin which is using JavaFX, but without including jfxrt.jar into the plugin jar ? Currently JavaFX should be on the classpath in Java 8, so there shouldn't be a need to export plugin with this library (or I'm wrong Smile )

[Updated on: Mon, 02 March 2015 20:36]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1646047 is a reply to message #1646025] Mon, 02 March 2015 20:48 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
That's exactly what efxclipse Core runtime does - it hooks the classloading and looks up jfxrt.jar from the jre
Re: FXCanvas not found during plugin export. [message #1646258 is a reply to message #1622950] Mon, 02 March 2015 23:12 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Ok. So I've downloaded E(fx)clipse and I checked two simple plugins:

1. Exactly the same plugin as I described in the post. Some "Sample menu"(from Eclipse plugins templates) that is opening JavaFX window. Behaviour is exactly the same as for simple Eclipse with FX plugin. If I don't add jfxrt.jar and jfxswt.jar, I won't be able to export it (FXCanvas not recognized when exporting).

2. Plugin from https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2
I followed each step as in tutorial. Everything works fine if I'm running it from Eclipse. When I'm exporting it to "dropins" and restarting IDE nothing happens. Plugin seems to be not installed, no error or exceptions is thrown on console where eclipse is run. (even with -Defxclipse.osgi.hook.debug=true in eclipse.ini file and setting SWT_GTGK3 to 0)

Code of the FXViewPart which I'm using is very simple:
public class MyViewPart extends FXViewPart {
	@Override
	protected Scene createFxScene() {
		return getScene();
	}

	@Override
	protected void setFxFocus() {
		
	}
		
 	Scene getScene() {
		System.out.println("Tworzenie sceny");

		Text hello;
		Text world;
		Scene scene;
		HBox hBox;

		hBox = HBoxBuilder.create().alignment(Pos.CENTER).build();

		scene = SceneBuilder.create().root(hBox).width(300).height(300).build();

		hello = TextBuilder.create().text("Hello").stroke(Color.ANTIQUEWHITE)
				.fill(Color.WHEAT).font(Font.font("Ubuntu", 41))
				.effect(new javafx.scene.effect.MotionBlur()).build();

		world = TextBuilder.create().text("World").stroke(Color.GRAY)
				.fill(Color.WHITESMOKE).font(Font.font("Ubuntu", 41))
				.effect(new Reflection()).build();

		scene.setFill(Color.BLACK);
		hBox.getChildren().addAll(hello, world);
		return scene;
	}
}


Is there any example(tutorial) how to write, export and install plugin which is using JavaFX in Eclipse ? Smile

[Updated on: Mon, 02 March 2015 23:21]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1647171 is a reply to message #1646258] Tue, 03 March 2015 09:36 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 03.03.15 00:12, Piotr Iksowski wrote:
> Ok. So I've downloaded E(fx)clipse and I checked two simple plugins:
>
> 1. Exactly the same plugin as I described in the post. Some "Sample
> menu" that is opening JavaFX window. Behaviour is exactly the same as
> for simple Eclipse with FX plugin. If I don't add jfxrt.jar and
> jfxswt.jar, I won't be able to export it (FXCanvas not recognized when
> exporting).

This is because jfxswt.jar is not on the classpath so:
a) use maven to build your plugin
b) modify the build.properties to point to the jfxswt.jar
c) copy jfxswt.jar to the ext-folder of the jdk/jre used to build

I would strongly advice to use a) because this is also how you will
build the stuff on hudson/jenkins/.... .

>
> 2. Plugin from https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2
> I followed each step as in tutorial. Everything works fine if I'm
> running it from Eclipse. When I'm exporting it to "dropins" and
> restarting IDE nothing happens. Plugin seems to be not installed, no
> error or exceptions is thrown on console where eclipse is run. (even
> with -Defxclipse.osgi.hook.debug=true in eclipse.ini file and setting
> SWT_GTGK3 to 0)
>
> Code of the FXViewPart which I'm using is very simple:
> public class MyViewPart extends FXViewPart {
> @Override
> protected Scene createFxScene() {
> return getScene();
> }
>
> @Override
> protected void setFxFocus() {
>
> }
>
> Scene getScene() {
> System.out.println("Tworzenie sceny");
>
> Text hello;
> Text world;
> Scene scene;
> HBox hBox;
>
> hBox = HBoxBuilder.create().alignment(Pos.CENTER).build();
>
> scene =
> SceneBuilder.create().root(hBox).width(300).height(300).build();
>
> hello =
> TextBuilder.create().text("Hello").stroke(Color.ANTIQUEWHITE)
> .fill(Color.WHEAT).font(Font.font("Ubuntu", 41))
> .effect(new javafx.scene.effect.MotionBlur()).build();
>
> world = TextBuilder.create().text("World").stroke(Color.GRAY)
> .fill(Color.WHITESMOKE).font(Font.font("Ubuntu", 41))
> .effect(new Reflection()).build();
>
> scene.setFill(Color.BLACK);
> hBox.getChildren().addAll(hello, world);
> return scene;
> }
> }
>
> Is there any example(tutorial) how to write, export and install plugin
> which is using JavaFX in Eclipse ? :)

The reason for that is most likely that your bundle did not resolve
because you have NOT deployed org.eclipse.fx.ui.workbench3 hence your
bundle does not resolve.

You can check the state of the bundle by:
* select the console view
* open the drop down in the far right
* select Host OSGi Console
* enter "ss org.eclipse.fx.ui.workbench3"
=> the first value in the list is the bundleId which you need in the
next step
* diag $BUNDLE_ID

Tom
Re: FXCanvas not found during plugin export. [message #1647859 is a reply to message #1647171] Tue, 03 March 2015 16:47 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Thanks for reply. Your answers are really useful.

Thomas Schindl wrote on Tue, 03 March 2015 09:36
On 03.03.15 00:12, Piotr Iksowski wrote:
> Ok. So I've downloaded E(fx)clipse and I checked two simple plugins:
>
> 1. Exactly the same plugin as I described in the post. Some "Sample
> menu" that is opening JavaFX window. Behaviour is exactly the same as
> for simple Eclipse with FX plugin. If I don't add jfxrt.jar and
> jfxswt.jar, I won't be able to export it (FXCanvas not recognized when
> exporting).

This is because jfxswt.jar is not on the classpath so:
a) use maven to build your plugin
b) modify the build.properties to point to the jfxswt.jar
c) copy jfxswt.jar to the ext-folder of the jdk/jre used to build

I would strongly advice to use a) because this is also how you will
build the stuff on hudson/jenkins/.... .


Ok, seems it's working. I thought that jfxswt.jat is in classpath by default in Java 8.

Thomas Schindl wrote on Tue, 03 March 2015 09:36
On 03.03.15 00:12, Piotr Iksowski wrote:
>
> 2. Plugin from https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2
> I followed each step as in tutorial. Everything works fine if I'm
> running it from Eclipse. When I'm exporting it to "dropins" and
> restarting IDE nothing happens. Plugin seems to be not installed, no
> error or exceptions is thrown on console where eclipse is run. (even
> with -Defxclipse.osgi.hook.debug=true in eclipse.ini file and setting
> SWT_GTGK3 to 0)
> ..............................
>
> Is there any example(tutorial) how to write, export and install plugin
> which is using JavaFX in Eclipse ? Smile

The reason for that is most likely that your bundle did not resolve
because you have NOT deployed org.eclipse.fx.ui.workbench3 hence your
bundle does not resolve.

You can check the state of the bundle by:
* select the console view
* open the drop down in the far right
* select Host OSGi Console
* enter "ss org.eclipse.fx.ui.workbench3"
=> the first value in the list is the bundleId which you need in the
next step
* diag $BUNDLE_ID

Tom


It seems that org.eclipse.fx.ui.workbench3 is lacking:
osgi> ss org.eclipse.fx.ui.workbench3
"Framework is launched."

id	State       Bundle
osgi> 


Is there any way to include org.eclipse.fx.ui.workbench3 into Target platform of the environment without using Tycho (or maven) ? Maybe there is a way to deploy it somehow with the plugin ?

I'm searching some simple solution for that, but I'm a little afraid that without getting acknowledge with Tycho, I won't resolve this and many other problems :/
Re: FXCanvas not found during plugin export. [message #1648066 is a reply to message #1647859] Tue, 03 March 2015 19:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 03.03.15 17:47, Piotr Iksowski wrote:
> Thanks for reply. Your answers are really useful.
>
> Thomas Schindl wrote on Tue, 03 March 2015 09:36
>> On 03.03.15 00:12, Piotr Iksowski wrote:
>> > Ok. So I've downloaded E(fx)clipse and I checked two simple plugins:
>> > > 1. Exactly the same plugin as I described in the post. Some "Sample
>> > menu" that is opening JavaFX window. Behaviour is exactly the same as
>> > for simple Eclipse with FX plugin. If I don't add jfxrt.jar and
>> > jfxswt.jar, I won't be able to export it (FXCanvas not recognized when
>> > exporting).
>>
>> This is because jfxswt.jar is not on the classpath so:
>> a) use maven to build your plugin
>> b) modify the build.properties to point to the jfxswt.jar
>> c) copy jfxswt.jar to the ext-folder of the jdk/jre used to build
>>
>> I would strongly advice to use a) because this is also how you will
>> build the stuff on hudson/jenkins/.... .
>
>
> Ok, seems it's working. I thought that jfxswt.jat is in classpath by
> default in Java 8.

jfxrt.jar is on the ext-classpath and i'm thankful that jfxswt.jar -
jfxswt.jar requires classes from swt! So if they would have put that on
the classpath this would have been a nightmare!

>
> Thomas Schindl wrote on Tue, 03 March 2015 09:36
>> On 03.03.15 00:12, Piotr Iksowski wrote:
>> > > 2. Plugin from https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2
>> > I followed each step as in tutorial. Everything works fine if I'm
>> > running it from Eclipse. When I'm exporting it to "dropins" and
>> > restarting IDE nothing happens. Plugin seems to be not installed, no
>> > error or exceptions is thrown on console where eclipse is run. (even
>> > with -Defxclipse.osgi.hook.debug=true in eclipse.ini file and setting
>> > SWT_GTGK3 to 0)
>> > ..............................
>> > > Is there any example(tutorial) how to write, export and install
>> plugin
>> > which is using JavaFX in Eclipse ? :)
>>
>> The reason for that is most likely that your bundle did not resolve
>> because you have NOT deployed org.eclipse.fx.ui.workbench3 hence your
>> bundle does not resolve.
>>
>> You can check the state of the bundle by:
>> * select the console view
>> * open the drop down in the far right
>> * select Host OSGi Console
>> * enter "ss org.eclipse.fx.ui.workbench3"
>> => the first value in the list is the bundleId which you need in the
>> next step
>> * diag $BUNDLE_ID
>>
>> Tom
>
>
> It seems that org.eclipse.fx.ui.workbench3 is lacking:
> osgi> ss org.eclipse.fx.ui.workbench3
> "Framework is launched."
>
> id State Bundle
> osgi>
> Is there any way to include org.eclipse.fx.ui.workbench3 into Target
> platform of the environment without using Tycho (or maven) ? Maybe there
> is a way to deploy it somehow with the plugin ?
>
> I'm searching some simple solution for that, but I'm a little afraid
> that without getting acknowledge with Tycho, I won't resolve this and
> many other problems :/

If you are doing Eclipse plug-in dev at least semi professional there's
not way around getting to learn how you deal with build tool who is able
to build OSGi-Bundles - maven tycho is one of them, bnd & bndtools
another one, gradle also does understand OSGi but it calls out the bnd.

To get your case running things are quite simple:
* create a feature in your IDE who has
- your.custom.plugin
- org.eclipse.fx.ui.workbench3
* export the feature
* drop your.custom.plugin & org.eclipse.fx.ui.workbench3 to dropins
folder and thing would work

Final word - deploying through dropins is also a bad way to do plugin
installation you should generate a p2-repo and use the install wizard
for real deployment.

Tom
Re: FXCanvas not found during plugin export. [message #1691467 is a reply to message #1648066] Tue, 07 April 2015 13:10 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
I came back to this problem and I'm trying to solve it as much properly as it is possible. I'm trying to make project using Tycho (/MVN).

After setting up the project, JavaFX is working fine except FXCanvas from jfxswt.jar, so I added this jar to plugin project (and to the classpath), but during running plugin, there still appeares exception:
java.lang.NoClassDefFoundError: com/sun/javafx/embed/HostInterface
	at basicplugin.actions.SampleAction.run(SampleAction.java:70)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
	at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
	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:4454)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	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(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	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.sun.javafx.embed.HostInterface cannot be found by BasicPlugin_1.0.0.201504071226
	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(ClassLoader.java:357)
	... 33 more


It seems that classes from jfxrt.jar are not recognizable. Is it possible (how) to make them recognizable without including it to the plugin project as jfxswt ? Structure of my plugin workspace is following:
- Plugin project
- Feature project
- Target project
- Aggregator project
- Update site project.
Re: FXCanvas not found during plugin export. [message #1691469 is a reply to message #1691467] Tue, 07 April 2015 13:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
What did you do? Did you really copied the jfxswt.jar to your project?
This is NOT how it works. You need to reconfigure maven to pick up
jfxswt.jar while compiling.

See how our build does it
http://git.eclipse.org/c/efxclipse/org.eclipse.efxclipse.git/tree/releng/org.eclipse.fx.ide.releng/pom.xml

Tom

On 07.04.15 15:10, Piotr Iksowski wrote:
> I came back to this problem and I'm trying to solve it as much properly
> as it is possible. I'm trying to make project using Tycho (/MVN).
> After setting up the project, JavaFX is working fine except FXCanvas
> from jfxswt.jar, so I added this jar to plugin project (and to the
> classpath), but during running plugin, there still appeares exception:
>
> java.lang.NoClassDefFoundError: com/sun/javafx/embed/HostInterface
> at basicplugin.actions.SampleAction.run(SampleAction.java:70)
> at
> org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
> at
> org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
>
> 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:4454)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
>
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
>
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
>
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
>
> 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(NativeMethodAccessorImpl.java:62)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:483)
> 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.sun.javafx.embed.HostInterface cannot be found by
> BasicPlugin_1.0.0.201504071226
> 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(ClassLoader.java:357)
> ... 33 more
>
>
> It seems that classes from jfxrt.jar are not recognizable. Is it
> possible (how) to make them recognizable without including it to the
> plugin project as jfxswt ? Structure of my plugin workspace is following:
> - Plugin project
> - Feature project
> - Target project
> - Aggregator project
> - Update site project.
Re: FXCanvas not found during plugin export. [message #1691501 is a reply to message #1691469] Tue, 07 April 2015 16:25 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Thanks. I had added pluginManagement part with jfxswt.jar. After that it was compiling, but during running the plugin I was getting exception about not recognizing FXCanvas.

To solve it, I have added jfxswt.jar path to Bundle-Classpath of plugin project. Currently there is no more exception about not recognizing FXCanvas, but there is still problem with jfxrt. I'm getting mentioned exception about HostInterface.

[Edit 1]
I've added jfxrt to Bundle-Classpath and now there is also no exception about not recognizing jfxrt.jar classes.

Unfortunately now I'm getting other exception....
java.lang.IllegalStateException: Not on FX application thread; currentThread = JavaFX Application Thread
	at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:204)
	at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:364)
	at javafx.scene.Scene.<init>(Scene.java:323)
	at javafx.scene.Scene.<init>(Scene.java:267)
	at javafx.scene.SceneBuilder.build(SceneBuilder.java:660)
	at basicplugin.actions.SampleAction.createFXScene(SampleAction.java:112)
	at basicplugin.actions.SampleAction.run(SampleAction.java:72)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
	at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
	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:4454)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	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(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	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)



When I'm running exactly the same code, but using simple plugin project without maven/tycho and creating own target platform, then this code is running without any problems. What could be the reason of it ?

[Updated on: Tue, 07 April 2015 16:47]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1691513 is a reply to message #1691501] Tue, 07 April 2015 17:49 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I repeat this is just plain wrong - you don't modify the bundle classpath - remove those entries believe me this is not the way to go.
Re: FXCanvas not found during plugin export. [message #1691583 is a reply to message #1691513] Wed, 08 April 2015 10:25 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Well... I believe, but I don't know how to solve it in such situation. When I'm removing these jars from MANIFEST.MF Bundle-Classpath project is still being compiled fine, but when I'm running it I'm getting

java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas
at basicplugin.actions.SampleAction.run(SampleAction.java:70)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
....

I searched solution for it and unfortunately the only recipes was basing on adding these jars to Bundle classpath :/

Currently I stucked on it and finding answers like...
http://www.codetrails.com/blog/osgi-ify-your-tools-jar
https://wiki.eclipse.org/FAQ_What_causes_my_plug-in_to_build_but_not_to_load_in_a_runtime_workbench%3F

[Updated on: Wed, 08 April 2015 10:31]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1691588 is a reply to message #1691583] Wed, 08 April 2015 11:01 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
First all on what version of e(fx)clipse are you working:
* 1.2.0
* 2.0.0 nightly

On 08.04.15 12:25, Piotr Iksowski wrote:
> Well... I believe, but I don't know how to solve it in such situation.
> When I'm removing these jars from MANIFEST.MF Bundle-Classpath project
> is still being compiled fine, but when I'm running it I'm getting
> java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas
> at basicplugin.actions.SampleAction.run(SampleAction.java:70)
> at
> org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
> at
> org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
>
> ...

Specify what running means:
a) running with an Inner-Eclipse instance
b) installed into another Eclipse instance

>
> I searched solution for it and unfortunately the only recipes was basing
> on adding these jars to Bundle classpath :/
>

This is what the adapter hooks are used for they modify the classloader
hierarchy to include jfxswt.jar. What happens if you run with
-Defxclipse.osgi.hook.debug=true.

I already explained at various locations that embedding jfxswt.jar and
jfxrt.jar is not working e.g. [1].

Tom

[1]http://tomsondev.bestsolution.at/2012/08/01/javafx-2-2-and-osgi/
Re: FXCanvas not found during plugin export. [message #1691599 is a reply to message #1691588] Wed, 08 April 2015 12:32 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
Thomas Schindl wrote on Wed, 08 April 2015 11:01
First all on what version of e(fx)clipse are you working:
* 1.2.0
* 2.0.0 nightly


1.2.0 e(fx)clipse plugin installed on Eclipse EE Luna SR2.

Thomas Schindl wrote on Wed, 08 April 2015 11:01

Specify what running means:
a) running with an Inner-Eclipse instance
b) installed into another Eclipse instance


b) installed into another Eclipse EE Luna SR2 instance

As I mentioned before, I've got following tycho/maven projects:
- Plugin project
- Feature project
- Target project
- Aggregator project
- Update site project.

After building the project (by "Run-> Maven build" or from command line mvn clean install/verify/package...), I'm getting ready to install repository in Update site project/target/repository.

I'm installing it in separate Eclipse EE IDE (Luna without any JavaFX support) by Help->Install new software....

Plugin is installing without any problems, but when I'm trying to use(open) some plugin component which is using FXCanvas, then I'm getting exception:

java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas
at basicplugin.actions.SampleAction.run(SampleAction.java:70)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
....

Component is quite simple(action binded with some menu button), for example:
public class SampleAction implements IWorkbenchWindowActionDelegate {
	private IWorkbenchWindow window;

	public SampleAction() {
	}

	public void run(IAction action) {
	
	// SWT
	try {
		Display display = Display.getCurrent();
		if (display == null) {
			display = new Display();
		}
		final Shell shell = new Shell(display);
		shell.setText("JavaFX / SWT Integration");
		shell.setLayout(new FillLayout());

		final FXCanvas canvas = new FXCanvas(shell, SWT.NONE); <- here throwing exception
		final Scene scene = createFXScene();
		canvas.setScene(scene);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()){
				display.sleep();
			}
		}
		// display.dispose();
	} catch (Throwable e) {
		e.printStackTrace();
	}
	}

.......

}


Plugin components without FXCanvas are working fine.

Quote:
This is what the adapter hooks are used for they modify the classloader
hierarchy to include jfxswt.jar. What happens if you run with
-Defxclipse.osgi.hook.debug=true
.


After setting it and opening component that is using FXCanvas, I'm getting:
org.eclipse.m2e.logback.configuration: Initializing logback
FXClassLoader#createJREBundledClassloader - Started
FXClassLoader#createJREBundledClassloader - Assumed location (Java 8/Java 7): /usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar
FXClassLoader#createJREBundledClassloader - SWT is available use different loading strategy
FXClassLoader#createJREBundledClassloader - Searching for SWT-FX integration at /usr/lib/jvm/java-8-oracle/jre/lib/jfxswt.jar
FXClassLoader#createJREBundledClassloader - Found SWT/FX
FXClassLoader#createJREBundledClassloader - Delegate to system classloader
FXClassLoader.SWTFXClassloader#init - Primary Loader sun.misc.Launcher$ExtClassLoader@a3e458
FXClassLoader.SWTFXClassloader#init - Lastresort Loader org.eclipse.osgi.internal.loader.EquinoxClassLoader@320be73[org.eclipse.swt:3.103.2.v20150203-1313(id=672)]
FXClassLoader#createJREBundledClassloader - Ended
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.Parent'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.layout.HBox'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.paint.Paint'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.paint.Color'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.effect.Effect'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.effect.MotionBlur'
FXModuleClassloader#findLocalClass trying to load class 'javafx.scene.effect.Reflection'
java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas
	at basicplugin.actions.SampleAction.run(SampleAction.java:59)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
	at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:237)
	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:4454)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	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(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	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: javafx.embed.swt.FXCanvas cannot be found by BasicPlugin_1.0.0.201504081219
	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(ClassLoader.java:357)
	... 33 more



[Updated on: Wed, 08 April 2015 12:49]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1691633 is a reply to message #1691599] Wed, 08 April 2015 16:20 Go to previous messageGo to next message
Piotr Iksowski is currently offline Piotr IksowskiFriend
Messages: 27
Registered: October 2014
Junior Member
When I add in plugin MANIFEST.MF "javafx.embed.swt;version="2.2.0"" in "Import-Package" everything works fine (there are no exceptions). Is it proper solution or only working solution and it should be solved in other way ? Smile

[Updated on: Wed, 08 April 2015 16:23]

Report message to a moderator

Re: FXCanvas not found during plugin export. [message #1691654 is a reply to message #1691633] Wed, 08 April 2015 18:22 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Yes that's required in 1.2.0 - in 2.0 it is not needed anymore!
Re: FXCanvas not found during plugin export. [message #1693780 is a reply to message #1691654] Tue, 28 April 2015 10:52 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
I don't get all this. Why is e(fx)clipse needed at all? The jfxswt jar is part of the JDK installation, so isn't the problem that the Eclipse JRE Definition under 'installed JRE's' isn't including it in its list of libraries. Why doesn't it include it? I just want to use FXCanvas, and I don't need all of the bloat that e(fx)clipse brings in. e.g. I don't care about XText etc. Also, people do not need to use Maven or Tycho to build distributions of commercial Eclipse plug-ins, and the implication in this thread that this is required is misleading.
I would like a simple solution that allows use of FXCanvas without bringing in unnecessary dependencies.
Re: FXCanvas not found during plugin export. [message #1693781 is a reply to message #1693780] Tue, 28 April 2015 11:00 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
Don't worry, I found your explanations at https://www.eclipse.org/forums/index.php/t/796180/
Re: FXCanvas not found during plugin export. [message #1693794 is a reply to message #1693780] Tue, 28 April 2015 11:36 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
ad) One does not need e(fx)clipse tooling because it is bloat
-------------------------------------------------------------
First of all there are 3 things:
* FXCanvas at IDE compile time
* FXCanvas at build compile time
* FXCanvas at runtime

You can argue that jfxswt.jar should simply be added to the
JRE-Libraries but that will not fix:
* your build time problems
* your runtime classpath problems

So you might need the e(fx)clipse bloat at least at runtime.

BTW you might be happy to see your complete codebase going YELLOW
because from the Eclipse JDT point of view javafx.* is restricted API
because it is on the ext-classpath!

If you want to have the correct solution then make Oracle contribute
their FXCanvas to SWT or e(fx)clipse instead of shipping it as an
ordinary JAR as part the JRE/JDK - but this would require them not use
internal APIs as part of FXCanvas AND make Oracle the JSR JavaFX.

ad) Useing maven & tycho is required
------------------------------------
Nobody ever said that you are required to do so but fixing the IDE jre
will not fix your build problems - so you need to teach any build tool
how to find jfxswt.jar at build time. We are using maven and this where
we provide guidance - if you want to use something else feel free to do
so but don't request from us that we provide you with help or guidance
on it.

ad) the tone of your mail
-------------------------
I'm not sure but I have somehow found the wording in your mail a bit
rude but maybe my feeling is wrong. If you want to make suggestions how
we could do better you are free to provide bugreports, feature requests,
.... .

Finally with Eclipse Luna is part of the release train and so you can
install the tooling from the release train update-site so all
dependencies resolve automatically.

Tom

On 28.04.15 12:52, Darren Hurt wrote:
> I don't get all this. Why is e(fx)clipse needed at all? The jfxswt jar
> is part of the JDK installation, so isn't the problem that the Eclipse
> JRE Definition under 'installed JRE's' isn't including it in its list of
> libraries. Why doesn't it include it? I just want to use FXCanvas, and I
> don't need all of the bloat that e(fx)clipse brings in. e.g. I don't
> care about XText etc. Also, people do not need to use Maven or Tycho to
> build distributions of commercial Eclipse plug-ins, and the implication
> in this thread that this is required is misleading.
> I would like a simple solution that allows use of FXCanvas without
> bringing in unnecessary dependencies.
Re: FXCanvas not found during plugin export. [message #1693796 is a reply to message #1693781] Tue, 28 April 2015 11:41 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Right this is another possible solution but requires custom repackaging
of swtfx.jar (at least to satisfy the IDE) but it won't fix the other
problems like restricted classpath warnings/errors, ... .

Tom

On 28.04.15 13:00, Darren Hurt wrote:
> Don't worry, I found your explanations at
> https://www.eclipse.org/forums/index.php/t/796180/
Re: FXCanvas not found during plugin export. [message #1693812 is a reply to message #1693794] Tue, 28 April 2015 13:14 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member

Hi Thomas.

Thanks for taking time to reply.
Sorry if it sounded rude. It wasn't meant to. I'm just very frustrated at the hoops I'm having to jump through just to use something that is distributed with the Java SDK from within Eclipse.
I realise there are sound technical reasons behind this difficulty, and that it is no fault of yours.
It is a slightly odd situation that Oracle distribute this when it depends on SWT which is not theirs and hence not present, so I see the awkwardness of this. It is kind of a dependency loop Smile. I think It would be better if the bridge was something provided and maintained by Eclipse rather than Oracle (like the old SWT_AWT bridge which I have made extensive use of in the past).
Anyway, let's see if I understand correctly....

here's what I **think** I need to do:

1. Add the update site to my target runtime.
2. Depend on 'org.eclipse.fx.javafx' from my plug-in.
3. Copy jfxswt.jar to the ext folder and make sure it is picked up by my installed JRE.
4. Add the javafx.embed.swt to 'Imported Packages'.
5. Write my code (which will compile but with API warnings).

Is this correct?
If so, and assuming it compiles and runs, does this mean I have to tell any users of the built plug-in to 'Copy jfxswt.jar to the ext folder' ?

Thanks,
Darren

Re: FXCanvas not found during plugin export. [message #1693816 is a reply to message #1693812] Tue, 28 April 2015 13:37 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 28.04.15 15:14, Darren Hurt wrote:
>
> Hi Thomas.
>
> Thanks for taking time to reply.
> Sorry if it sounded rude. It wasn't meant to. I'm just very frustrated
> at the hoops I'm having to jump through just to use something that is
> distributed with the Java SDK from within Eclipse. I realise there are
> sound technical reasons behind this difficulty, and that it is no fault
> of yours.
> It is a slightly odd situation that Oracle distribute this when it
> depends on SWT which is not theirs and hence not present, so I see the
> awkwardness of this. It is kind of a dependency loop :). I think It
> would be better if the bridge was something provided and maintained by
> Eclipse rather than Oracle (like the old SWT_AWT bridge which I have
> made extensive use of in the past).
> Anyway, let's see if I understand correctly....
>
> here's what I **think** I need to do:
>
> 1. Add the update site to my target runtime.
> 2. Depend on 'org.eclipse.fx.javafx' from my plug-in.
> 3. Copy jfxswt.jar to the ext folder and make sure it is picked up by my
> installed JRE.
> 4. Add the javafx.embed.swt to 'Imported Packages'.
> 5. Write my code (which will compile but with API warnings).
>
> Is this correct?

Are we now talking about the fact that you don't install the e(fx)clipse
tooling?

> If so, and assuming it compiles and runs, does this mean I have to tell
> any users of the built plug-in to 'Copy jfxswt.jar to the ext folder' ?
>

No your users ARE NOT affected - the runtime classpath is handled by the
efxclipse runtime additions.

Tom
Re: FXCanvas not found during plugin export. [message #1693817 is a reply to message #1693812] Tue, 28 April 2015 13:54 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
In fact it doesn't work still insofar as running from Eclipse (via a Eclipse Application launcher) still fails as it fails to find the FXCanvas. It's definitely using the execution environment that points at the installed JRE that includes the jfxswt.jar, so I'm a bit puzzled.....
What am I missing (assuming I have done steps I mentioned in last post)?

Thanks,

Darren
Re: FXCanvas not found during plugin export. [message #1693818 is a reply to message #1693817] Tue, 28 April 2015 13:57 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Did you add -Dosgi.framework.extensions=org.eclipse.fx.osgi to the VM Arguments of the product configuration?
Re: FXCanvas not found during plugin export. [message #1693819 is a reply to message #1693818] Tue, 28 April 2015 14:04 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
Ok, I added this and now get a brand new error! The FXClassLoader now seems unable to find core SWT classes. Why might this be?
Thanks,
Darren



!ENTRY org.eclipse.ui 4 0 2015-04-28 15:00:54.824
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Canvas
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.fx.osgi.fxloader.FXClassLoader$FXModuleClassloader$1.findLocalClass(FXClassLoader.java:149)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:324)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:320)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:379)
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(ClassLoader.java:357)
at com.canary.model.projects.editors.HTMLBrowserPreview.renderHTMLFX(HTMLBrowserPreview.java:60)
Re: FXCanvas not found during plugin export. [message #1693820 is a reply to message #1693816] Tue, 28 April 2015 14:09 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
What should I install? I installed into the target runtime from the update site as described in your guide, and then depended on the single plug-in a mentioned and added the imported package as described.

What exactly should I install as a bare minimum?
Installing the tooling into my base Eclipse (I didn't think I needed to - just the target platform) seemed to bring in a lot. What is it that I need just for my very minimal requirements?

Thanks,

Darren
Re: FXCanvas not found during plugin export. [message #1693824 is a reply to message #1693820] Tue, 28 April 2015 14:19 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Are you talking about this guide? https://blog.codecentric.de/en/2015/04/add-javafx-controls-swt-eclipse-4-application-eclipse-rcp-cookbook/

Or which guide do you mean?
Re: FXCanvas not found during plugin export. [message #1693830 is a reply to message #1693817] Tue, 28 April 2015 15:05 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Let's start from a clean state:
a) How did you fix the INSTALLED JRE
a1) you copied jfxswt.jar to ext
a2) you modified INSTALLED JRE
b) You have installed e(fx)clipse

Tom

On 28.04.15 15:54, Darren Hurt wrote:
> In fact it doesn't work still insofar as running from Eclipse (via a
> Eclipse Application launcher) still fails as it fails to find the
> FXCanvas. It's definitely using the execution environment that points at
> the installed JRE that includes the jfxswt.jar, so I'm a bit
> puzzled..... What am I missing (assuming I have done steps I mentioned
> in last post)?
> Thanks,
>
> Darren
Re: FXCanvas not found during plugin export. [message #1693834 is a reply to message #1693824] Tue, 28 April 2015 16:02 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
No, this one

https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2
Re: FXCanvas not found during plugin export. [message #1693836 is a reply to message #1693834] Tue, 28 April 2015 16:20 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member

Ok, so I assume I shouldn't need to copy fxswt.jar to the ext folder and that e(fx)clipse should resolve the jar (and it's downstream dependencies) if I have the correct set-up in my target platform and manifest.

The tutorial (https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2) doesn't work for me. Presumably had this template appeared and worked it would have created a project with the correct dependencies and I wouldn't have had to ask. However it doesn't even appear.
That being so, what are the dependencies?

So let's assume I follow the instructions for the target platform as given here (for 1.2.0). What dependencies etc. do i need to add to my project in order to 'see' (compile time etc.) the Java FX SWT classes and for them to be present and working when I run an Eclipse Application launcher that includes all of these dependencies on its class-path?
Up until now I've just added org.eclipse.fx.javafx as a dependency.
Also, do I need the 'Imported packages' to include the javafx.embed.swt in the 'Imported packages'?
Assume my launcher has the vm argument (-Dosgi.framework.extensions=org.eclipse.fx.osgi) set.

Darren
Re: FXCanvas not found during plugin export. [message #1693837 is a reply to message #1693836] Tue, 28 April 2015 16:22 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
By the way, I have been writing Eclipse plug-ins for thirteen years, so you can assume whatever I am missing is not likely a newbie error etc.
Re: FXCanvas not found during plugin export. [message #1693838 is a reply to message #1693837] Tue, 28 April 2015 16:38 Go to previous messageGo to next message
Darren Hurt is currently offline Darren HurtFriend
Messages: 32
Registered: July 2009
Member
So let's assume the clean slate as you say, and that I start from an Eclipse (LUNA) with no knowledge of e(fx)clipse.
I'm using java 8, it is my installed JRE, and the execution environment for my plug-in (and launchers etc.).
here is what I tried:

1. I add it to a new target platform via the update site 'http://download.eclipse.org/efxclipse/runtime-released/1.2.0/site' and tick the new target so that it is indeed my target platform.
2. I add a plug-in dependency on org.eclipse.fx.javafx.
3. I add javafx.embed.swt to 'Imported Packages'.
4. I add -Dosgi.framework.extensions=org.eclipse.fx.osgi to my launcher VM arguments, and make sure that org.eclipse.fx.javafx and its downstream dependencies are on my launcher class-path.

What steps am I missing?

Thanks,

Darren
Re: FXCanvas not found during plugin export. [message #1693839 is a reply to message #1693836] Tue, 28 April 2015 16:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Could you please post a screenshot of your JRE and Plug-in Dependency in
the Package Explorer!

Tom

On 28.04.15 18:20, Darren Hurt wrote:
>
> Ok, so I assume I shouldn't need to copy fxswt.jar to the ext folder and
> that e(fx)clipse should resolve the jar (and it's downstream
> dependencies) if I have the correct set-up in my target platform and
> manifest.
>
> The tutorial (https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2)
> doesn't work for me. Presumably had this template appeared and worked it
> would have created a project with the correct dependencies and I
> wouldn't have had to ask. However it doesn't even appear.
> That being so, what are the dependencies?
>
> So let's assume I follow the instructions for the target platform as
> given here (for 1.2.0). What dependencies etc. do i need to add to my
> project in order to 'see' (compile time etc.) the Java FX SWT classes
> and for them to be present and working when I run an Eclipse Application
> launcher that includes all of these dependencies on its class-path?
> Up until now I've just added org.eclipse.fx.javafx as a dependency.
> Also, do I need the 'Imported packages' to include the javafx.embed.swt
> in the 'Imported packages'?
> Assume my launcher has the vm argument
> (-Dosgi.framework.extensions=org.eclipse.fx.osgi) set.
>
> Darren
>
Re: FXCanvas not found during plugin export. [message #1693840 is a reply to message #1693836] Tue, 28 April 2015 16:39 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 28.04.15 18:20, Darren Hurt wrote:
>
> Ok, so I assume I shouldn't need to copy fxswt.jar to the ext folder and
> that e(fx)clipse should resolve the jar (and it's downstream
> dependencies) if I have the correct set-up in my target platform and
> manifest.

No if e(fx)clipse tooling is successfully installed you don't have to do
any copying!

>
> The tutorial (https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2)
> doesn't work for me. Presumably had this template appeared and worked it
> would have created a project with the correct dependencies and I
> wouldn't have had to ask. However it doesn't even appear.

This leads me to believe that e(x)clipse is not appropiately installed.
Are there other JavaFX entries in the New Project wizard? If you open
the Host OSGi console and look at the org.eclipse.fx bundles what is
their state?

> That being so, what are the dependencies?
>
> So let's assume I follow the instructions for the target platform as
> given here (for 1.2.0). What dependencies etc. do i need to add to my
> project in order to 'see' (compile time etc.) the Java FX SWT classes
> and for them to be present and working when I run an Eclipse Application
> launcher that includes all of these dependencies on its class-path?
> Up until now I've just added org.eclipse.fx.javafx as a dependency.
> Also, do I need the 'Imported packages' to include the javafx.embed.swt
> in the 'Imported packages'?
> Assume my launcher has the vm argument
> (-Dosgi.framework.extensions=org.eclipse.fx.osgi) set.
>

How is the target platform defined? Please provide a screenshot. I
somehow have to reproduce your setup to see what's going wrong.

Tom
Previous Topic:focus on window
Next Topic:TrimBar does not apear after setVisible()/setToBeRendered()
Goto Forum:
  


Current Time: Sat Apr 27 01:23:59 GMT 2024

Powered by FUDForum. Page generated in 0.06081 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top