If you follow my blog you’ve noticed that I’m currently investing some of my OSS time into JavaFX. The project I’m working on is named e(fx)clipse and until now I’ve been working most of the time on the tooling front but like I promised I don’t only want to provide tooling but also a runtime framework.
So when it comes to runtimes the most important thing for me is that I’m able to use an OSGi-Container (for me equinox is the one with the highest priority) and because JavaFX is NOT shiped with the appropriate OSGi-Metadata it is not as easy to use JavaFX 2.0 in an OSGi-Application.
So I explored multiple different options:
- Repackage it
- Use a bootclass-path
- Use Adapter Hooks
The important things for me are:
- I don’t want to modify the plain javafx-jar shiped by Oracle – not even sure I would be allowed to do that
- I’d like to have seemless integration into PDE, so developing an JavaFX-OSGi application should be not different to SWT/Swing
- I’d like to use the standard export and build tools (Product-Export from IDE, maven-tycho)
- I’d like to follow OSGi best practices as much possible (e.g. you do a package-import in the client-bundles, let OSGi-wire up stuff at runtime appropriately, …)
In the end I came to the conclusion that using Adapter Hooks is the way to go. So I went ahead and implemented support for this which will make it extremly simple for you to implement JavaFX 2.0 application with Eclipse, Equinox and e(fx)clipse – There are still some glitches in Eclipse to make the PDE-export and JDT happy but I’m going to look into this later on because once you know them they are not really a problem to solve.
I’ll describe in more detail on how to create an (Equinox)OSGi-enabled JavaFX-Application when I release e(fx)clipse 0.0.6 but here are some screenshots to see that this isn’t a pipedream.
As always when having problems questions about some OSGi stuff Tom Watson from Equinox helped me to get into the right direction.
For those interested in how I managed to teached Equinox the location of the default JavaFX 2.0 classes can look at my github-repo where I already pushed the code and examples to.