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.

About these ads

16 Responses to “JavaFX 2 and OSGi-Deployment models”

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

    Regards,
    Markus

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

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

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

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

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

  5. 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)

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

Trackbacks/Pingbacks

  1. Java desktop links of the week, March 12 | Jonathan Giles - March 11, 2012

    [...] Schindl has announced that the next release of e(fx)clipse will contain improved OSGi support. This makes it easier to use JavaFX within Eclipse [...]

  2. JavaFX links of the week, March 12 // JavaFX News, Demos and Insight // FX Experience - March 11, 2012

    [...] Schindl has announced that the next release of e(fx)clipse will contain improved OSGi support. This makes it easier to use JavaFX within Eclipse [...]

  3. e(fx)clipse 0.0.13 released | Tomsondev Blog - March 22, 2012

    [...] already teasered this new feature in a blog post. When writing and provisioning equinox based JavaFX applications you can now select a deployment [...]

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

Follow

Get every new post delivered to your Inbox.

Join 714 other followers

%d bloggers like this: