简体   繁体   English

如何导出tornadofx应用程序?

[英]How do I export a tornadofx application?

I finished writing a little tornadofx app in IntelliJ CE and now want to export it as a single file which can be downloaded and launched by users. 我在IntelliJ CE中编写了一个小的tornadofx应用程序,现在想将其导出为单个文件,可以由用户下载和启动。 For now it would be sufficient to provide a single jar file. 现在,提供单个jar文件就足够了。 But it would be also great to know on how to export a self contained installer for OSX, Windows and Linux. 但是,了解如何为OSX,Windows和Linux导出自包含安装程序也很棒。 Unfortunately I don't know how to do any of that. 不幸的是我不知道怎么做。 Can you help? 你能帮我吗?

Have a look at the FxLauncher project, which is also from the creator of tornadoFX. 看看FxLauncher项目,该项目也来自tornadoFX的创建者。 FXLauncher allows you to easily distribute your javafx/tornadoFX application. FXLauncher允许您轻松分发您的javafx / tornadoFX应用程序。 The project provides a maven-plugin which allows you to generate a self containing javafx/tornadoFX application that you then publish to a web-server or common directory (eg an internal app in your company network). 该项目提供了一个maven-plugin,允许您生成一个包含javafx / tornadoFX应用程序的self,然后将其发布到Web服务器或公共目录(例如公司网络中的内部应用程序)。 After that you can generate native installers for Linux, OSX and Windows. 之后,您可以为Linux,OSX和Windows生成本机安装程序。 The installer itself will only install a small app, which will know the location of your web-serve or directory. 安装程序本身只会安装一个小应用程序,它会知道您的Web服务或目录的位置。 On startup it will download the latest deployed version of you application and run it. 在启动时,它将下载最新部署的应用程序版本并运行它。 Additional links: 其他链接:

In case you want a single jar file, you can export it as a regular Java program (not the JavaFX option in IntelliJ). 如果您需要单个jar文件,可以将其导出为常规Java程序(而不是IntelliJ中的JavaFX选项)。 You do this by creating and building an artifact. 您可以通过创建和构建工件来完成此操作。

  • Go to the Project Structure window, and from there select Artifacts 转到Project Structure窗口,然后从中选择Artifacts
  • Click the "+" icon to create a new artifact, and select JAR > From modules with dependencies... 单击“+”图标以创建新工件,然后选择JAR>从具有依赖项的模块...
  • Select the main class and press OK 选择主类并按OK

And that's it, the artifact has been set up, now, to generate jar file, just go to Build > Build Artifacts menu, and select the newly-made artifact, and the IntelliJ will generate the jar file in the "out" directory. 就是这样,现在已经设置了工件来生成jar文件,只需转到Build> Build Artifacts菜单,然后选择新制作的工件,IntelliJ将在“out”目录中生成jar文件。

Not sure if this is the best solution, but it's what I've been using, and it works for me. 不确定这是否是最佳解决方案,但这是我一直在使用的,它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM