JavaFx: second application throws Not on FX application thread

微笑、不失礼 提交于 2019-12-11 02:49:10

问题


I have and osgi based application. The loading process is the following: start.sh runs not osgi loader.jar which starts felix and installs and starts bundles. By other words start.sh->loader.jar->osgi+bundles. I want to show loading process in loader.jar via javafx and I use there Application.launch(Gui.class). Everything is ok. The problem appears when in osgi bundle main program is started (also via Application.launch) and I get :

Caused by: java.lang.IllegalStateException: Application launch must not be called more than once

At stackoverflow I found the following solution how to run the second application https://stackoverflow.com/a/13439473/4568213. However, the provided solution works only if it's located "inside" javafx application, for example in start() method. If it's out it throws

Caused by: java.lang.IllegalStateException: Not on FX application thread; currentThread = main" exception.

How can I solve such problem. By other words how to get inside running javafx application and create the second stage?

来源:https://stackoverflow.com/questions/30445375/javafx-second-application-throws-not-on-fx-application-thread

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