-1

I want run JavaFX application with module but dont know how to do. I tried several times but i never got it. I use Eclipse, and export the proyect with the first selected option.

Image

module MiProgramaInterfaz {
requires javafx.controls;
requires javafx.fxml;
requires java.xml;
requires javafx.base;


opens controlador to javafx.graphics, javafx.fxml, javafx.base;
opens modelo.clases to javafx.graphics, javafx.fxml, javafx.base;
opens principal to javafx.graphics, javafx.fxml, javafx.base;

}

The last command i tried was this

java -p app.jar -m MiProgramaInterfaz/principal.Main

but i got this error:

Error occurred during initialization of boot layer

java.lang.module.FindException: Module javafx.fxml not found, required by MiProgramaInterfaz

I tried steps from https://openjfx.io/openjfx-docs/#install-javafx but nothing

ReTuR
  • 1
  • 3
    not sure what you mean by "run outside" - if you want to deploy a fx application, work through a tutorial on how to it (see the javafx tag wiki for references) – kleopatra Apr 21 '22 at 15:52

1 Answers1

2

You have two options To run a JavaFX application:

  • Use a Java runtime embedding JavaFX, like the SDK provided by Gluon or the JDK/JRE from Azul. Then the command you tried should work. You can check if JavaFX is included in the runtime by running java --list-modules.
  • Use a standard Java runtime. Then you must must add to the module path (-p option) the jars containing the modules you need, like javafx-controls-17.0.2-linux.jar.

When running a modular application, a jar must contain only 1 module. So building a fat jar file like you tried won't work. Select "copy required libraries to a sub-folder" and either use option 1 without using the sub-folder, or use option 2 and add the subfolder to your module path.