简体   繁体   English

如何在不使用 Maven/Gradle/IDE 的情况下部署自包含的 JavaFX 应用程序?

[英]How to deploy a self-contained JavaFX application without using Maven/Gradle/IDEs?

I'm working on a simple JavaFX project using: Windows , VSCode/PowerShell , Java SDK 17.0.2 , JavaFX SDK 17.0.2 . I'm working on a simple JavaFX project using: Windows , VSCode/PowerShell , Java SDK 17.0.2 , JavaFX SDK 17.0.2 .

Here is my project structure:这是我的项目结构:

bin/
    snaptools/
        Controller.class
        Main.class
        SnapTransceiver.class
        icon.png
        snaptools.fxml
lib/
    openjfx-17.0.2_windows-x64_bin-sdk/
        ...
    jSerialComm-2.9.1.jar
    snaprotocol-1.0.0.jar
src/
    snaptools/
        Controller.java
        Main.java
        SnapTransceiver.java
        icon.png
        snaptools.fxml

I can compile the project using this command line:我可以使用以下命令行编译项目:

javac -encoding UTF-8 -d bin --class-path "lib/jSerialComm-2.9.1.jar;lib/snaprotocol-1.0.0.jar" --module-path lib/openjfx-17.0.2_windows-x64_bin-sdk/javafx-sdk-17.0.2/lib --add-modules javafx.controls,javafx.fxml src/snaptools/*.java

I can run the program using this command line:我可以使用以下命令行运行程序:

java --class-path "bin;lib/jSerialComm-2.9.1.jar;lib/snaprotocol-1.0.0.jar" --module-path lib/openjfx-17.0.2_windows-x64_bin-sdk/javafx-sdk-17.0.2/lib --add-modules javafx.controls,javafx.fxml snaptools.Main

My project is pretty much done.我的项目差不多完成了。 I just need to package it.我只需要 package 就可以了。 Unfortunately, it seems everybody is using Maven/Gradle and IDE-specific tricks (Eclipse, NetBeans, IntelliJ).不幸的是,似乎每个人都在使用 Maven/Gradle 和特定于 IDE 的技巧(Eclipse、NetBeans、IntelliJ)。 I don't want to depend on these methods.我不想依赖这些方法。

What I want:我想要的是:

  • An executable.exe file without installation process (one big file that only executes and preferably extracts nothing).一个没有安装过程的executable.exe文件(一个只执行并且最好什么都不提取的大文件)。
  • Without using Maven/Gradle (I'll probably put everything in a makefile).不使用 Maven/Gradle(我可能会将所有内容都放在一个 makefile 中)。
  • Without the need of using a specific IDE (I use VSCode, but I don't want to depend on it either).无需使用特定的 IDE(我使用 VSCode,但我也不想依赖它)。
  • Can be done by command lines on a regular terminal.可以通过常规终端上的命令行来完成。
  • Contain everything it needs to execute (user doesn't need to install anything).包含它需要执行的所有东西(用户不需要安装任何东西)。

Is it possible?可能吗? Btw, I've also been messing with Launch4j, jpackage, and jlink, but couldn't figure it out.顺便说一句,我也一直在搞乱 Launch4j、jpackage 和 jlink,但无法弄清楚。

Apologies if you have already come across it, but you might find it useful to take a look at https://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm抱歉,如果您已经遇到它,但您可能会发现查看https://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm 很有用

This guide provides basic and advanced information about building, packaging, and deploying your JavaFX application.本指南提供有关构建、打包和部署 JavaFX 应用程序的基本和高级信息。 JavaFX deployment requires no special code in your application and has many other differences from Java deployment. JavaFX 部署在您的应用程序中不需要特殊代码,并且与 Java 部署有许多其他差异。 Even if you are an advanced Java developer, it is a good idea to review the Getting Started page.即使您是高级 Java 开发人员,查看入门页面也是一个好主意。

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

相关问题 自包含JavaFX应用程序中的包含图标 - Include icon in Self-Contained JavaFX application 部署 JavaFX 应用程序、创建 JAR 和自包含应用程序以及本机安装程序的最佳方式是什么 - What is the best way to deploy JavaFX application, create JAR and self-contained applications and native installers 在Eclipse中创建JavaFX自包含应用程序(使用自定义JDK) - Create JavaFX self-contained application (with custom JDK) in Eclipse JavaFX:将参数传递给自包含应用程序不起作用 - JavaFX: passing Arguments to a Self-Contained Application does not work 如何使用捆绑在JavaFX 2自包含应用程序中的JRE在Mac OS X上启动可运行的JAR? - How to use the JRE bundled in a JavaFX 2 self-contained application to start a runnable JAR on Mac OS X? 如何将动态JVM命令行标志传递给自包含的JavaFX应用程序? - How can dynamic JVM command line flags be passed to a self-contained JavaFX application? Maven自包含的儿童神器 - Maven self-contained child artifact 使用Maven创建自包含的源代码版本 - Creating a self-contained source release with Maven 自包含的Javafx应用程序无法在ubuntu中运行:GLIBCXX_3.4.21的问题 - self-contained javafx application fail to run in ubuntu : issue with GLIBCXX_3.4.21 JavaFX自包含的应用程序缺少密码加密服务吗? - JavaFX self-contained apps are missing the Cipher cryptographic service?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM