Search code examples
javaosgijavafxbndtools

Move jfxrt to lib/ext for OSGI purposes


It has been suggested that part of the solution of the problem with javafx classloading and osgi is to move jfxrt to the Java installation lib/ext directory so that it is loaded when the JVM starts.

If this is done in a private install of Java the javafx classes are available at design time but are not found at run time when a javafx bundle is installed.

Is it possible that this can be made to work?

I am using felix and bndtools in eclipse as dev environment on Ubuntu 12.04.


Solution

  • First, the bundles that are using javafx packages must import them with Import-Package.

    Next you need to get the system bundle to export the packages. By default the system bundle only exports the standard JRE packages plus the OSGi framework packages; you can extend this by setting the property org.osgi.framework.system.packages.extra. Since you are using Bndtools (good!) you can set the property as follows:

    -runsystempackages: javafx.foo,javafx.bar...