简体   繁体   English

JavaFX 应用程序:双击启动?

[英]JavaFX Application : launching by double click?

I have created a JavaFX application in order to register data on my personal computer (Windows 10) and I am looking for launching it by double clicking on its JAR.我创建了一个 JavaFX 应用程序,以便在我的个人计算机 (Windows 10) 上注册数据,我正在寻找通过双击其 JAR 来启动它。

thank you in advance for your help.预先感谢您的帮助。

Vinz文茨

well i had the same problem after i was taught to use JAVAFX a week ago we had to use command line but that led to an idea好吧,一周前我被教导使用 JAVAFX 后,我遇到了同样的问题,我们不得不使用命令行,但这导致了一个想法

java -jar --module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" --add-modules javafx.controls,javafx.fxml yourjarfile.jar

type above in notepad and save it as a batch file (.cmd) launch the batch file在记事本中键入上面的内容并将其另存为批处理文件 (.cmd) 启动批处理文件

or shall i say double click!!!或者我应该说双击!!!

I would suggest using a launcher.我建议使用启动器。 It would give you many options like minimum and maximum supported JRE versions, heap size, and error messages' alerts.它将为您提供许多选项,例如支持的最小和最大 JRE 版本、堆大小和错误消息警报。 Take a look at Launch4j .看看Launch4j

This is all not the way it is done today.这完全不是今天的做法。 Just use jpackage, which comes with JDK 14, and build a real application or installer with it.只需使用 JDK 14 附带的 jpackage,并用它构建一个真正的应用程序或安装程序。 Then you can not only double click to launch your application, you will also benefit from all the other goodies like icons, install/uninstall, desktop integration, ... Have a look here to see how it works: https://github.com/dlemmermann/JPackageScriptFX然后你不仅可以双击启动你的应用程序,你还可以从图标、安装/卸载、桌面集成等所有其他好东西中受益......看看它是如何工作的: https://github。 com/dlemmermann/JPackageScriptFX

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

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