How to export javaFX 14 app to executable in IntelliJ?

这一生的挚爱 提交于 2020-05-24 05:33:13

问题


I wanna export my app to PC and Android devices. If i create a JavaFX project with sdk 13.0 and try to export as a JavaFX application it says fx:deploy not supported. So i tried gluon plugin. But when i open a project i cant run even the empty scene. I found one tutorial on the internet how to do that, but he had inside the build.grandle some long settings, and i have only one line

apply plugin: 'base'

And i get this error every time

The project uses Gradle 4.3.1 which is incompatible with Java 10 or newer.

What is the easiest way to export java app to exe or apk ?


回答1:


Creating an installer for the desktop platforms (Windows, macOS, Linux) has become easy these days. The tool of choice is jpackage which started to be shipped with JDK 14. It can either be used on the command line on the finished project or you can use a Gradle plugin (https://github.com/beryx/badass-jlink-plugin). If your project is not modularized you could follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which also uses jpackage but together with Maven and some other tools from the JDK. The Maven part could easily be rewritten to Gradle, if needed.

Building for Android or iOS is another story. You will need the Gluon client-gradle-plugin (https://github.com/gluonhq/client-gradle-plugin) to do that. But I think it is rather naive to believe that an application which is written for the desktop can be used one to one on a mobile platform. Technically this would work for a hello-world like demo but not for a real application just because your environment, the form-factor and many other things are just different. So you will have to adjust your project to accomdate that.



来源:https://stackoverflow.com/questions/61548367/how-to-export-javafx-14-app-to-executable-in-intellij

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