How To Deploy a JavaFX 19 JAR with a MySQL using JDBC in IntelliJ 2022.3.2 on Windows 11 x64

Опубликовано: 04 Октябрь 2024
на канале: Ken
1,125
18

This tutorial video demonstrates how to connect to a MySQL database using JDBC in a JavaFX application, and how to deploy the application as an executable JAR file in IntelliJ 2022.3.2 on Windows 11 x64.

MySQL Connector/J (JDBC) installation directory

C:\Program Files\Java\mysql-connector-j-8.0.32

Java installation directory.

C:\Program Files\Java\jdk-19

JavaFX installation directory.

C:\Program Files\Java\javafx-sdk-19.0.2.1

Setting Environment Variables

JAVA_HOME="C:\Program Files\Java\jdk-19"

JAVA_HOME tells your OS where there Java installation directory lives.

PATH="%JAVA_HOME%\bin"

PATH specifies where the Java executable directory resides.

If you are not sure how to set up environment variables, you can refer to    • How To Install JDK 15.0.2 on Windows ...  ​

VM options
--module-path "C:\Program Files\Java\javafx-sdk-19.0.2.1\lib"
--add-modules javafx.controls,javafx.fxml

Leaving a space between the two module names, like this: --add-modules=javafx.controls, javafx.fxml, may result in a syntax error. Therefore, it is important to ensure that there is no space between the module names when using the --add-modules option with JavaFX.

JDK 19.0.2
MySQL JDB
JavaFX SceneBuilder 19.0.2.1
IntelliJ IDEA 2022.3.2
Windows 11 Pro x64

#JavaFX​​19 #ExecutableJar​​ #DeployJar​ #CreateJar #JDBC