Search code examples
javafxmysql-connectorjlink

MySQL-Connector does not work after using JLink in a JavaFx project


I am trying to create an executable out of my JavaFX project that uses mysql-connector driver to connect to a local database. After i generate the JLink folder via the pom.xml file, when i run my application, the connection between the database and the app does not work (Running the application in the IDE makes everything work fine). I am using InteliJ as my IDE, MySQL for the database and i think the connector is a jar file without a module-info.jar file which is causing issues in JLink.

I did some digging and i found out that mysql-connector can not be added directly via Jlink. I've seen some workarounds (for example: moditect) but i still can't figure it out. Any help is greatly appreciated!


Solution

  • You can't use jlink to directly create an executable file if your application is not fully modular. However, you can use a combination of jdeps, jlink and jpackage to create an application bundle or an installer. You might want to have a look at this tutorial: https://github.com/dlemmermann/JPackageScriptFX