在Windows WinPlatformFactory上找不到JavaFx + Felix [英] JavaFx + Felix on windows WinPlatformFactory not found

查看:109
本文介绍了在Windows WinPlatformFactory上找不到JavaFx + Felix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Apache felix和swing的桌面应用程序,带有精巧的Javafx UI,maven精巧的依赖项将javafx加载到项目中,并且在Mac上运行良好.

I have a desktop application that uses Apache felix and swing, with embebed javafx UIs, javafx is being loaded into the project by a maven embebed dependency, and it works fine on mac.

但是当我在Windows上运行它时,出现以下错误:

But when i run it on windows it gives me the following error:

java.lang.ClassNotFoundException: com.sun.glass.ui.win.WinPlatformFactory not found by my-software [38]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(undleWiringImpl.java:2018)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
    at com.sun.glass.ui.Application.run(Application.java:146)
    at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
    at javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:215)
    at javafx.embed.swing.JFXPanel.<init>(JFXPanel.java:230)
    at br.com.mysoftware.fx.java.DownloadExplorer.initAndShowGUI(DownloadExplorer.java:68)
    at br.com.mysoftware.fx.java.DownloadExplorer$1.run(DownloadExplorer.java:120)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)____________________________Welcome to Apache Felix Gogo


    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Failed to load Glass factory class Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.sun.glass.ui.Application.run(Application.java:146)
    at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
    at javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:215)
    at javafx.embed.swing.JFXPanel.<init>(JFXPanel.java:230)
    at br.com.mysoftware.fx.java.DownloadExplorer.initAndShowGUI(DownloadExplorer.java:68)
    at br.com.mysoftware.fx.java.DownloadExplorer$1.run(DownloadExplorer.java:120)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

推荐答案

javafx通过maven精巧的依赖项被加载到项目中

javafx is being loaded into the project by a maven embebed dependency

我不认为嵌入javafx jar是正确的方法,如果那是您正在做的事情.我想您会缺少一些本机部分.

I don't think embedding the javafx jar is the correct approach, if that is what you're doing. You'll be missing some native parts, I guess.

而是使用"org.osgi.framework.system.packages.extra"机制.

Rather use the "org.osgi.framework.system.packages.extra" mechanism.

您可以看一下Dromber FX代码(JavaFX的模块化应用程序框架,它结合了JavaFX和OSGi;我是该框架的作者):

You can have a look at the Dromber FX code (the modular application framework for JavaFX, which combines JavaFX and OSGi ; I'm the author of this framework):

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆