How to deploy JavaFX in Swing desktop application
I managed to embed JavaFX HTMLEditor inside a Swing desktop application using this this tutorial, locally in Eclipse all works great.
My question is how to deploy this to our customers? Oracle have a tutorial for WebStart and Applet deployment but I see no information for desktop apps.
Currently I copy libs and binaries from my installed JavaFX SDK into my project and include them when I compile distribution:
/my/application/lib/javafx/lib/javafxrt.jar
/my/application/lib/javafx/bin/[dll:s from JavaFX Runtime]
But this seems very odd, there must be a better way? I need some help here. The thing is that during development in Eclipse I need javafxrt.jar
on the classpath, so I've copied the jar file because I couldn't see any environment variable like javafx_home
I could use. But when JavaFX is loaded it tries to load the dlls: from a relative path, that's why I also copied the dlls into my project.
This is problematic for deployment, I rather not ship 32 bits JavaFX Runtime if clients have a 64 bits JVM installed (that won't work I think). Currently our customers only run Windows so for the moment that's not a problem.
Isn't there a way in runtime to check if JavaFX is installed or not, and if so get path to it "dynamically"? Shipping the jar file is no problem, but I'm worried about the platform dependent binaries.
Update: WebStart is not an option because we bundle/install the application with an old Windows app that is the predecessor, not all functionality is ported yet so the two applications communicate with a custom made IPC protocol.
Any help is appreciated! Thanks in advance.
Use Java Web Start to deploy the app. JWS makes it simple to add dependent Jars & natives to the run-time class-path of an application, and can partition the download of natives by platform.
In fact, I'd be surprised if the JavaFX API does not already offer an extension JNLP that client apps. can simply link to in their own JNLP launch file.
Use the new JavaFX ant tasks described here. Worked fine for me.
EDIT: Also see native packaging: https://blogs.oracle.com/talkingjavadeployment/entry/native_packaging_for_javafx
You can embed a JavaFX component in java swing application using JFXPanel (javafx.embed.swing.JFXPanel). it is used to embedded JavaFX components in the java swing application. learn more about JFXPanel at https://docs.oracle.com/javase/8/javafx/api/javafx/embed/swing/JFXPanel.html
链接地址: http://www.djcxy.com/p/68186.html