Search code examples
javajavafxjvmderbylaunch4j

JavaFX - Derby error missing components in Launch4j


I'm making a javafx Library Management System project using intellij idea that uses derby as an embedded db, and it works just fine, but when i convert my project into a jar file using the build artefact option in intellij idea then convert that jar into an .exe file using launch4j and try to run it, it will throw a

JavaFX runtime components are missing, and are required to run this application

enter image description here

i tried adding the jvm options through the jvm options section in launch4j but then i would get another error saying that i can't access the sub packages that contain the other classes that i want to use :- enter image description here

the thing is that i want this program to run when i run the .exe file so is there a way to add these jvm options inside my code, or is there a better way to run javafx-db programs with a different extension ? and how should i include in the jvm options that i'm using sub packages?


Solution

  • Solving this took me some time, first you need to set the DERBY_PATH and the PATH_TO_FX to your libs then you need to add these commands in the JVM options

    --module-path %DERBY_HOME%;%PATH_TO_FX% --add-modules javafx.controls,javafx.fxml,java.sql,java.desktop,javafx.swing,javafx.graphics

    building this will add the options in an xml file that runs every time you run the program