Test Apache Felix with Java 8 and JavaFX

血红的双手。 提交于 2019-11-28 11:40:30

JavaFX applications depend on packages from the JavaFX APIs, such as javafx.application and several others. Since it looks like you have built your bundle with Maven Bundle Plugin, your bundle already has these dependencies declared. This is a good thing.

In Java 8 the javafx.* packages are provided by the base JRE. However OSGi does not automatically export every package from the JRE, simply because all JREs have a bunch of non-standard packages (e.g. com.sun.* etc) that normal application code should not have access to. Therefore OSGi only makes available the packages that are defined by the relevant JCP Specification for the version of Java that you are using. For example packages such as javax.swing, org.w3c.dom, etc.

Since JavaFX is not a standard, there is no JCP Specification for JavaFX, and OSGi does not export the javafx.* packages. However you can configure OSGi to do this for you by setting the following configuration property when you launch OSGi:

org.osgi.framework.system.packages.extra=javafx.application,...

NB I have shown how to add the javafx.application package to your runtime. It is likely you will need to add several more, i.e. all of the packages from the JavaFX API. I am not sufficiently familar with JavaFX to list these, but they should be easy enough for you to find.

I have recently released a first Early Access version of Drombler FX, a modular Rich Client Platform for JavaFX based on OSGi and Maven (POM-first; uses Apache Felix by default).

You can read more about it here: http://puces-blog.blogspot.ch/2012/12/drombler-fx-building-modular-javafx.html

Getting Startet: http://wiki.drombler.org/GettingStarted

I recenttly tried to run it with a pre-release of Java SE 8 and it worked so far, though I haven't specified the system packages for Java SE 8 yet, so I'm not sure if everything works/ if you have access to everything.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!