Skip to main content


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 VollandFriend
Messages: 29
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 SchindlFriend
Messages: 6651
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 VollandFriend
Messages: 29
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 SchindlFriend
Messages: 6651
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 VollandFriend
Messages: 29
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 SchindlFriend
Messages: 6651
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 VollandFriend
Messages: 29
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 messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
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.
Re: JavaFX classes not resolved after product export [message #1482817 is a reply to message #1228905] Sat, 22 November 2014 03:39 Go to previous messageGo to next message
Thomas Schäfer is currently offline Thomas SchäferFriend
Messages: 6
Registered: November 2014
Junior Member
Hi Tom,
I got a similar Problem like the one described above.
I have an e4 application running on swt with embeded javafx.

The product runs fine when I execute it in eclipse. But I am not able to export the product using eclipse or maven. I always get an compilation error.

I'm using Java 1.8. There are no other Jdk's installed on my PC. When I do mvn --version it confirms, that maven uses java 1.8.0_25. Eclipse uses jdk 1.8_25 too.


[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.21.0:compile (default-compile) on project Test: Compilation failure: Compilation failure:
[ERROR] C:\Workspace\Test\TestApp\src\orion\part\AddAnfragePart.java:[11]
[ERROR] import javafx.embed.swt.FXCanvas;


Do have any idea what my problem is?

Thx in advance
Re: JavaFX classes not resolved after product export [message #1484509 is a reply to message #1482817] Sun, 23 November 2014 14:02 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
FXCanvas is NOT part of any default classpath! You need to add it
yourself as a maven dep.

If you look at our build you'll notice lines like this:

.....

> <pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-compiler-plugin</artifactId>
> <version>${tycho-version}</version>
> <configuration>
> <encoding>UTF-8</encoding>
> <extraClasspathElements>
> <extraClasspathElement>
> <groupId>com.oracle</groupId>
> <artifactId>javafx</artifactId>
> <version>8.0.0-SNAPSHOT</version>
> <systemPath>${java.home}/lib/jfxswt.jar</systemPath>
> <scope>system</scope>
> </extraClasspathElement>
> </extraClasspathElements>
> </configuration>
> </plugin>

These lines add jfxswt.jar to the classpath for the compiler, at runtime
our OSGi-Hook makes sure it is found.

Tom

On 23.11.14 14:31, Thomas Schäfer wrote:
> Hi Tom,
> I got a similar Problem like the one described above. I have an e4
> application running on swt with embeded javafx.
> The product runs fine when I execute it in eclipse. But I am not able to
> export the product using eclipse or maven. I always get an compilation
> error.
>
> I'm using Java 1.8. There are no other Jdk's installed on my PC. When I
> do mvn --version it confirms, that maven uses java 1.8.0_25. Eclipse
> uses jdk 1.8_25 too.
>
> [ERROR] Failed to execute goal
> org.eclipse.tycho:tycho-compiler-plugin:0.21.0:compile (default-compile)
> on project Test: Compilation failure: Compilation failure:
> [ERROR] C:\Workspace\Test\TestApp\src\orion\part\AddAnfragePart.java:[11]
> [ERROR] import javafx.embed.swt.FXCanvas;
>
> Do have any idea what my problem is?
>
> Thx in advance
Re: JavaFX classes not resolved after product export [message #1489811 is a reply to message #1484509] Thu, 27 November 2014 18:03 Go to previous messageGo to next message
Thomas Schäfer is currently offline Thomas SchäferFriend
Messages: 6
Registered: November 2014
Junior Member
Thx.
This solved my problem. I thought with java 1.8 you wouldn't need that anymore.
Re: JavaFX classes not resolved after product export [message #1489905 is a reply to message #1489811] Thu, 27 November 2014 19:53 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
If you i think about it twice it makes completely sense that its not on
any classpath. How on earth could something on the ext-classpath depend
on a user library (in case of OSGi it's event "worse" a bundle!)!

Tom

On 27.11.14 19:03, Thomas Schäfer wrote:
> Thx. This solved my problem. I thought with java 1.8 you wouldn't need
> that anymore.
Previous Topic:dependency on org.apache.commons.lang.text
Next Topic:Standalone StyledTextArea
Goto Forum:
  


Current Time: Fri Mar 29 02:18:44 GMT 2024

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

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

Back to the top