Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » JavaFX classes not resolved after product export
JavaFX classes not resolved after product export [message #1228599] Tue, 07 January 2014 15:32 Go to next message
Sun Volland is currently offline Sun Volland
Messages: 26
Registered: September 2010
Junior Member
Hi,

I created a e4 application (kepler on linux with jdk1.7.0_21) with a plugin providing a part with JavaFX content (using a FXCanvas).

I added the adapter-hook plugin and set the -Dosgi.framework.extensions=org.eclipse.fx.osgi and -Defxclipse.osgi.hook.debug=true
options. Everything works fine when I launch the application from within eclipse (the javafx content is displayed), the following lines are logged to the console :

FXClassLoadingConfigurator - This is the classloading configurator
FXClassLoadingConfigurator - Adding hooks for classloading
MyBundleClassLoader#createClassloader - checking for JRE bundled javafx
MyBundleClassLoader#createJREBundledClassloader - Started
MyBundleClassLoader#createJREBundledClassloader - Assumed location (Java 8/Java 7): /home/svolland/java/jdk1.7.0_21/jre/lib/ext/jfxrt.jar
MyBundleClassLoader#createJREBundledClassloader - Assumed location (Java 7): /home/svolland/java/jdk1.7.0_21/jre/lib/jfxrt.jar
MyBundleClassLoader#createJREBundledClassloader - Ended

Now when I export the product and launch from the command line, the javafx canvas won't show up. Only the following is logged on output:

FXClassLoadingConfigurator - This is the classloading configurator
FXClassLoadingConfigurator - Adding hooks for classloading

and the log file contains the following error:

!MESSAGE Unable to create class 'svd.e4fx.fxview.MyFXView' from bundle '68'
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.Error: Unresolved compilation problems:
The import javafx.beans.property.BooleanProperty cannot be resolved
The import javafx.beans.value.ChangeListener cannot be resolved
The import javafx.beans.value.ObservableValue cannot be resolved
The import javafx.embed.swt.FXCanvas cannot be resolved
The import javafx.scene.Node cannot be resolved
The import javafx.scene.Scene cannot be resolved
[...]
at svd.e4fx.fxview.MyFXView.<init>(MyFXView.java:5)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.eclipse.e4.core.internal.di.ConstructorRequestor.execute(ConstructorRequestor.java:44)
... 64 more

It looks like the hook is installed but does not resolve JavaFX classes also the org.eclipse.fx.[core|javafx|osgi] are in the plugins directory.

Maybe someone has a clue on what could be wrong or missing ?

Thanks,
Sun

Re: JavaFX classes not resolved after product export [message #1228607 is a reply to message #1228599] Tue, 07 January 2014 15:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
[...]

> It looks like the hook is installed but does not resolve JavaFX classes
> also the org.eclipse.fx.[core|javafx|osgi] are in the plugins directory.
>

So you exported it through the product export right? So after the export
you should have gotten a popup with the information that there where
problems.

The reason for this is that the PDE-Export does not know about the
javafx library which is not on the classpath. The error you see is NOT
that javafx classes could not resolved but the compiler had problem
compiling your code!

There are 2 possible solutions:
a) you use JDK8 for exporting (this could exhibt other problems if you
e.g. custom collection implementations)
b) you are using tycho and use the extraclasspath element for the tycho-
compiler pointing it to the javafxrt.jar

Tom
Re: JavaFX classes not resolved after product export [message #1228615 is a reply to message #1228599] Tue, 07 January 2014 16:15 Go to previous messageGo to next message
Sun Volland is currently offline Sun Volland
Messages: 26
Registered: September 2010
Junior Member
Quote:

So you exported it through the product export right? So after the export
you should have gotten a popup with the information that there where
problems.


Okay my fault, no popup but I missed the warnings, I guess I somehow misconfigured my warnings/errors preferences.

Quote:

There are 2 possible solutions:
a) you use JDK8 for exporting (this could exhibt other problems if you
e.g. custom collection implementations)
b) you are using tycho and use the extraclasspath element for the tycho-
compiler pointing it to the javafxrt.jar


So the only way to properly "export" an Eclipse 4 product which makes use of javafx is to setup maven projects for the plugins/features/products and build using Tycho, right ?
Re: JavaFX classes not resolved after product export [message #1228619 is a reply to message #1228615] Tue, 07 January 2014 16:31 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
On 07.01.14 17:15, Sun Volland wrote:
> Quote:
>> So you exported it through the product export right? So after the export
>> you should have gotten a popup with the information that there where
>> problems.
>
>
> Okay my fault, no popup but I missed the warnings, I guess I somehow
> misconfigured my warnings/errors preferences.
>
> Quote:
>> There are 2 possible solutions:
>> a) you use JDK8 for exporting (this could exhibt other problems if you
>> e.g. custom collection implementations)
>> b) you are using tycho and use the extraclasspath element for the tycho-
>> compiler pointing it to the javafxrt.jar
>
>
> So the only way to properly "export" an Eclipse 4 product which makes
> use of javafx is to setup maven projects for the
> plugins/features/products and build using Tycho, right ?
>

Yes - hitting export inside the IDE isn't a good idea anyways in the
long run, a professional application has to be built headless on a CI
server like jenkins.

It isn't really hard to do this with tycho, unfortunately for
SWT-Applications there's no wizard that would bootstrap it for you. For
pure e4 on fx application the wizard generates the necessary
infrastructure for you.

You could give that a spin and see how it looks like and then do some
monkey see, monkey do.

Tom
Re: JavaFX classes not resolved after product export [message #1228625 is a reply to message #1228619] Tue, 07 January 2014 16:50 Go to previous messageGo to next message
Sun Volland is currently offline Sun Volland
Messages: 26
Registered: September 2010
Junior Member
Sure, I'm fine with generating e4 products with tycho, jenkins, etc.

I was just expecting the fx tooling to provide export functionality like run functionality for quick hacking Smile

Thanks for your prompt replies,
Sun
Re: JavaFX classes not resolved after product export [message #1228669 is a reply to message #1228625] Tue, 07 January 2014 19:13 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
Hi,

Well the problem is that I once patched PDE-Build which is running when
you are exporting in the IDE. Unforunately there's NOONE maintaining
PDE-Build anymore and patching the IDE on the fly is a really bad style
if there's another opion available for JDK7.

One more idea i have is that you could set it as an external compiletime
library in your build.properties!

Tom

On 07.01.14 17:50, Sun Volland wrote:
> Sure, I'm fine with generating e4 products with tycho, jenkins, etc.
>
> I was just expecting the fx tooling to provide export functionality like
> run functionality for quick hacking :)
>
> Thanks for your prompt replies,
> Sun
Re: JavaFX classes not resolved after product export [message #1228881 is a reply to message #1228669] Wed, 08 January 2014 09:16 Go to previous messageGo to next message
Sun Volland is currently offline Sun Volland
Messages: 26
Registered: September 2010
Junior Member
Great tip ! setting it as an external compile time library does the job, product export now works fine (I had to copy the jfxrt.jar in the plugin's project to make it available as an external dependency).
Ok it's a dirty hack, but saved me setting up the tycho machinery.
Re: JavaFX classes not resolved after product export [message #1228905 is a reply to message #1228881] Wed, 08 January 2014 10:17 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
I'd still keep this on the agenda to be done!

Tom

On 08.01.14 10:16, Sun Volland wrote:
> Great tip ! setting it as an external compile time library does the job,
> product export now works fine (I had to copy the jfxrt.jar in the
> plugin's project to make it available as an external dependency). Ok
> it's a dirty hack, but saved me setting up the tycho machinery.
Previous Topic:JavaFX Preview Problem
Next Topic:contribute to context menu from E3 plugin in FXML view?
Goto Forum:
  


Current Time: Fri Oct 24 09:50:28 GMT 2014

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

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