JFX as an OSGi service?
Stephen Winnall
steve at winnall.ch
Sat Feb 20 00:28:07 UTC 2016
Anirvan, Kevin
Thanks for this.
I’m an expert neither in JavaFX nor in OSGi, but I think the basis of the JavaFX/OSGi incompatibility is control. To work with OSGi, JavaFX has to relinquish control of its startup sequence to OSGi in such a way that javafx.application.Application (or its proxy) is instantiated by OSGi and submits to OSGi’s bundle/service lifecycle. AN OSGi expert can probably formulate this better…
Platform.startup(runnable) /might/ do it. Platform.launch(class) doesn’t because the object thereby instantiated is always under the control of JavaFX - and thus not of OSGi.
I’m not comfortable using JFXPanel: if I wanted to use Swing I wouldn’t be trying to use JavaFX. But thank you for the hint.
Steve
> On 19 Feb 2016, at 16:41, Kevin Rushforth <kevin.rushforth at oracle.com> wrote:
>
> And for JDK 9 there is now:
>
> Platform.startup(Runnable);
>
> -- Kevin
>
>
> Anirvan Sarkar wrote:
>>
>> Hi Stephen,
>>
>> FYI, there is another way of initializing JavaFX runtime. Just use:
>>
>> new JFXPanel();
>>
>> It is documented[1] that FX runtime is initialized when the first JFXPanel
>> instance is constructed.
>>
>> Also JavaFX 9 will provide an official API to start the FX platform [2] [3].
>>
>>
>> [1]
>> https://docs.oracle.com/javase/8/javafx/api/javafx/application/Platform.html#runLater-java.lang.Runnable <https://docs.oracle.com/javase/8/javafx/api/javafx/application/Platform.html#runLater-java.lang.Runnable>-
>> [2] https://bugs.openjdk.java.net/browse/JDK-8090585 <https://bugs.openjdk.java.net/browse/JDK-8090585>
>> [3]
>> http://download.java.net/jdk9/jfxdocs/javafx/application/Platform.html#startup-java.lang.Runnable <http://download.java.net/jdk9/jfxdocs/javafx/application/Platform.html#startup-java.lang.Runnable>-
>>
>>
>> On 18 February 2016 at 20:08, Stephen Winnall <steve at winnall.ch> <mailto:steve at winnall.ch> wrote:
>>
>>
>>> As I understand it, there are two ways of activating JavaFX:
>>>
>>> 1) sub-class javafx.application.Application or
>>> 2) call javafx.application.Application.launch()
>>>
>>>
>>
>>
>>
>>
More information about the openjfx-dev
mailing list