Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Tycho build compiler cannot find javafx classes
Tycho build compiler cannot find javafx classes [message #1736591] Thu, 30 June 2016 13:36 Go to next message
Matthias F is currently offline Matthias FFriend
Messages: 20
Registered: June 2011
Junior Member
I'm currently trying to add a FX view to my e4 SWT application.

This is the description I tried to follow: https://blog.codecentric.de/en/2015/04/add-javafx-controls-swt-eclipse-4-application-eclipse-rcp-cookbook/

I'm on ubuntu 14.04 with oracle JDK8 and eclipse 4.5.2. Tycho is in version 0.24.0.

What I did:

Installed efxclipse 2.3.0 IDE features.
Added the RCP e4 Target Platform Feature 2.3.0 to the base target platform.
Add -Dosgi.framework.extensions=org.eclipse.fx.osgi

From inside eclipse its now working, however my tycho build fails:

[Quote:

...
ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile (default-compile) on project [...]: Compilation failure: Compilation failure:
...
[ERROR] import javafx.embed.swt.FXCanvas;
[ERROR] ^^^^^^^^^^^^^^^^
[ERROR] The import javafx.embed.swt cannot be resolved
...


The tycho build also resolves the target platform (adds the non p2 dependencies to my base target platform). I also added the p2 site http://download.eclipse.org/efxclipse/runtime-released/2.3.0/site to the tycho repositories.
This setup is already working without javaFX so the problem seems to be somewhere else.

The last part of the description says to copy the jfxswt.jar, which probably is not a good idea. I though using efxclipse would solve exactly that?

I also checked this: https://www.eclipse.org/forums/index.php/t/796180/

But I can't find the bundles org.eclipse.fx.osgi and org.eclipse.fx.javafx) to add as dependencies to my bundle.
Re: Tycho build compiler cannot find javafx classes [message #1736594 is a reply to message #1736591] Thu, 30 June 2016 14:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Have you tried to set

-Dorg.osgi.framework.bundle.parent=ext


instead of the osgi.framework.extensions parameter?

My blog post was using e(fx)clipse 1.2 and that is one change that happened with 2.0.
Re: Tycho build compiler cannot find javafx classes [message #1736640 is a reply to message #1736594] Thu, 30 June 2016 17:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You need to add the swtfx.jar to your tycho setup classpath
Re: Tycho build compiler cannot find javafx classes [message #1736673 is a reply to message #1736640] Fri, 01 July 2016 06:20 Go to previous messageGo to next message
Matthias F is currently offline Matthias FFriend
Messages: 20
Registered: June 2011
Junior Member
Hi,

@Dirk: running from eclipse works fine with the osgi.framework.extensions argument. Using -Dorg.osgi.framework.bundle.parent=ext causes a ClassNotFound(FXCanvas) when I open the FX-Part.

@Tom: Would this just be needed during compile time? I think shipping the jar itself would not be possible (legally). If so, how would I do this? My tycho build is pom-less.

Which of the target features do I actually need here? The rest of my target platform is already working, so all the e4 bundles etc. are already coming from other sites. Is the minimal JavaFX integration eneough?
Re: Tycho build compiler cannot find javafx classes [message #1736686 is a reply to message #1736673] Fri, 01 July 2016 07:30 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You don't ship that jar - it's only a compile time depdency, at runtime
the AdapterHooks take care to find the jar.

Take a look at our tycho config [1] eg for the IDE build where we
reference FXCanvas.

Just modify your the following to your root pom.xml:

> <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>



Tom

[1]http://git.eclipse.org/c/efxclipse/org.eclipse.efxclipse.git/tree/releng/org.eclipse.fx.ide.releng/pom.xml

On 01.07.16 08:20, Matthias F wrote:
> Hi,
>
> @Dirk: running from eclipse works fine with the
> osgi.framework.extensions argument. Using
> -Dorg.osgi.framework.bundle.parent=ext causes a ClassNotFound(FXCanvas)
> when I open the FX-Part.
>
> @Tom: Would this just be needed during compile time? I think shipping
> the jar itself would not be possible (legally). If so, how would I do
> this? My tycho build is pom-less.
>
> Which of the target features do I actually need here? The rest of my
> target platform is already working, so all the e4 bundles etc. are
> already coming from other sites. Is the minimal JavaFX integration eneough?
Re: Tycho build compiler cannot find javafx classes [message #1736715 is a reply to message #1736686] Fri, 01 July 2016 09:56 Go to previous messageGo to next message
Matthias F is currently offline Matthias FFriend
Messages: 20
Registered: June 2011
Junior Member
Thanks, now the build is working Smile

Running with -Dorg.osgi.framework.bundle.parent=ext still doesn't work. Any ideas on that? I don't have any required bundles or imports, like you mentioned here: https://www.eclipse.org/forums/index.php/t/1063826/

As said above I added the RCP e4 Target Platform Feature to my target. Which *.fx.* plugins do I need to add to my product definition?

I tried searching the git but didn't find anything that could show my how to do it.
Re: Tycho build compiler cannot find javafx classes [message #1736716 is a reply to message #1736715] Fri, 01 July 2016 10:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
-D... will never work with FXCanvas as the jar is on no classpath. Always Need the AdapterHook to include fx in swt
Re: Tycho build compiler cannot find javafx classes [message #1736729 is a reply to message #1736716] Fri, 01 July 2016 11:03 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Thomas Schindl wrote on Fri, 01 July 2016 12:04
-D... will never work with FXCanvas as the jar is on no classpath. Always Need the AdapterHook to include fx in swt


Sorry, I forgot about that. So forget about my answer, it was completely misleading.
Re: Tycho build compiler cannot find javafx classes [message #1736730 is a reply to message #1736716] Fri, 01 July 2016 11:07 Go to previous messageGo to next message
Matthias F is currently offline Matthias FFriend
Messages: 20
Registered: June 2011
Junior Member
Oh, good to know. Now everything is working, thanks a lot Tom! (I'm now using the minimal feature for the target)

Maybe it would be a good idea to update the tutorials. I think the eFXclipse Tutorial 2 would have been the appropriate one, but it is very outdated. A simple, current tutorial on how to add single FX views and parts into an existing SWT app would be really helpful!
Re: Tycho build compiler cannot find javafx classes [message #1736802 is a reply to message #1736730] Fri, 01 July 2016 21:31 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
It's a Wiki if you think some info is wrong/outdated feel free to fix it
Previous Topic:How to get EMF-Edit for JavaFX
Next Topic:EMF-Edit - mapping features to table columns
Goto Forum:
  


Current Time: Sat Apr 20 03:41:05 GMT 2024

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

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

Back to the top