JavaFX 2 and OSGi-Deployment models


It looks like a lot of people are interested in using JavaFX into one of their Eclipse Views. I infer that from the people visiting my blog from a stackoverflow question.

The problem people face is that in Eclipse JavaFX has to run in an OSGi-Environment and JavaFX is not prepared for that leading to all sorts of problems when one applies the standard strategies (e.g. simply repackaging the javafx.jar as an OSGi-Bundle).

I’m happy to announce that the upcoming e(fx)clipse release 0.0.13 will fix your problems and make it very easy to use JavaFX inside your Eclipse Views.

The important changes that went into 0.0.13 is that different deployment models are going to be supported:

  • System installation: This deployment model requires your users to have JavaFX pre-installed on their system
  • Next to your app installation: This deployment model requires you to place javafx next to your RCP/IDEs launcher – similar to how you can deploy a JRE with your Eclipse Application
  • As a bundle installation: Here you place your javafx.jar into an OSGi-Bundle and the e(fx)clipse runtime will take care of extracting and wireing

If you want to see it in action you can download a self-contained win32/32bit version of a RCP using this link which uses the 3rd deployment strategy.

The sources are checked into the e(fx)clipse git-repo.

Once 0.0.13 is released (which is going to be next weekend) I hope I can come up with a tutorial.

This entry was posted in e(fx)clipse. Bookmark the permalink.

16 Responses to JavaFX 2 and OSGi-Deployment models

  1. Pingback: Java desktop links of the week, March 12 | Jonathan Giles

  2. Pingback: JavaFX links of the week, March 12 // JavaFX News, Demos and Insight // FX Experience

  3. Markus says:

    Hi Tom, I got an 403 for http://www.efxclipse.org/downloads/efxrcp.zip.
    Maybe you could fix that!?

    Regards,
    Markus

  4. Not Relevant says:

    403: Access forbidden! when trying to retrieve http://www.efxclipse.org/downloads/efxrcp.zip

  5. Not Relevant says:

    I think I have to wait for the next generation of 16-cores GPUs in order to enjoy JavaFX

    • Tom Schindl says:

      I’m not sure – maybe it is not using the directx or opengl pipeline and so falls back to software rendering? Did you try to execute a simple JavaFX demo and run it with debug output so that you find out which pipeline it uses?

  6. Rad says:

    I extracted the source for the example plug-in from your github (at.bestsolution.efxclipse.runtime.examples.rcp) and I got:

    java.lang.IllegalStateException: Could not find a JavaFX 2.0.2 Installation
    at at.bestsolution.efxclipse.runtime.osgi.fxloader.FXClassLoader$MyBundleClassLoader.createClassloader(FXClassLoader.java:273)

    How do I correctly add the javafx.jar to the plugin?

    Thanks

    • Tom Schindl says:

      I think you are running in e(fx)clipse 0.0.12 and there the classloader is not prepared for this new deployment model stuff – you should wait until 0.0.13 (due this weekend) and then the application from the git-repo will start working. 0.0.13 will come with a wizard that allows you to repackage an installed javafx-rt as an OSGi-Bundle useable for the new deployment mode.

  7. Pingback: e(fx)clipse 0.0.13 released | Tomsondev Blog

  8. vitu says:

    http://www.efxclipse.org/tut4.html

    Dont work on Linux

    java 7, javafx 2.2, e(fx) lastest

    java.lang.IllegalStateException: Could not find a JavaFX installation. Run with -Defxclipse.osgi.hook.debug=true to get debug output. Check your osg/arch ‘linux/x86_64’ in case you want to use repackaging.
    at at.bestsolution.efxclipse.runtime.osgi.fxloader.FXClassLoader$MyBundleClassLoader.createClassloader(FXClassLoader.java:698)
    at at.bestsolution.efxclipse.runtime.osgi.fxloader.FXClassLoader$MyBundleClassLoader.(FXClassLoader.java:193)
    at at.bestsolution.efxclipse.runtime.osgi.fxloader.FXClassLoader.createClassLoader(FXClassLoader.java:92)

  9. William says:

    Hi Tom.

    Nowadays, We have a project with JDK 1.7_17 and JavaFX 2.2.7 with different features and plugins. One plugin has javafx and one dependency with at.bestsolution.efxclipse.runtime.javafx and this works fine.
    My problem is when i tried to compile my product with tycho and maven, because always got an error of compilation failure due to javafx.
    These errors are for example that not found the import javafx.embed.swt.FXCanvas, import javafx.scene.Scene, so on. Can you help me? I want to know as i should configure my main pom.xmml to find the jar javafx.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s