2016-11-02 95 views
0

我試圖運行我的Maven的OSGi JavaFX項目,但我不斷收到以下錯誤:org.osgi.framework.BundleException:無法解決缺少的需求osgi.wiring.package; (osgi.wiring.package = javafx.application)

org.osgi.framework.BundleException: Unable to resolve launcher [4](R 4.0): missing requirement [launcher [4](R 4.0)] osgi.wiring.package; (osgi.wiring.package=javafx.application) Unresolved requirements: [[launcher [4](R 4.0)] osgi.wiring.package; (osgi.wiring.package=javafx.application)] 
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111) 
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2117) 
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) 
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) 
    at impl.App.loadBundles(App.java:84) 
    at impl.App.initialize(App.java:60) 
    at impl.App.main(App.java:26) 

mvn clean package作品完美,我得到我生成項目罐子。

一些閱讀各地已經讓我this StackOverflow answer

JavaFX applications depend on packages from the JavaFX APIs, such as javafx.application and several others.

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,...

我如何能實現上述的建議,或者我能做些什麼來解決這個問題?

回答

0

在您構建框架對象的應用程序中,傳入配置參數的Map。您可以使用所需的javafx軟件包在地圖中設置org.osgi.framework.system.packages.extra屬性。

+0

謝謝你的回覆。你能說明@BJ Hargrave嗎? –

+0

@ Program-Me-Rev BJ給出的答案中缺少的是什麼,以及我在回答你所關聯問題時給出的答案?我已將你的問題標記爲重複。 –

相關問題