1

I'm trying to distribute a JavaFX application.

As an example project I took the JavaFX and NetBeans -> Non-modular with Maven. The code can be found here: GitHub: openjfx/samples.

On my machine this application works. But when I try to run that JAR on another machine, it says:

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

In the section Non-modular with Maven, that problem is being addressed. As a solution it suggests:

Properties -> Libraries -> Run -> Modulepath -> + -> Add Library and add the JavaFX12

But my project properties look different. They are missing Libraries:

enter image description here

Both machines run on Ubuntu and Java 11.

Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181
  • 2
    Since you are using Maven, this [answer](https://stackoverflow.com/questions/52653836/maven-shade-javafx-runtime-components-are-missing/52654791#52654791) will help, but it is also documented in the tutorial you have mentioned https://openjfx.io/openjfx-docs/#modular, Non-modular projects section. – José Pereda Jun 12 '19 at 09:49

1 Answers1

0

In my case, I work with windows systems, but I think that it's similiar on linux. the problem is that openjdk and javafx no always are available on other computers and dont are included on .jar.

When I want use my app on a other computer, I must build an installer this content:

  1. myapp.jar
  2. openjdk library folder
  3. javafxsdk library folder

And on shortcut I indicate the runs commands calling all modules that I use on my app:

--module-path="../../javafx-sdk-11.0.1/lib/" --add-modules="javafx.web" --add-modules="javafx.controls" --add-modules="javafx.fxml" --add-modules="javafx.base" -jar ../../myapp.jar

In your case, maybe you only needs create a shortcut with commands and indicate correctly the routes of your .jar, openjdk and javafxsdk and, of course, download them on the computer that runs your app.

mdrg89
  • 61
  • 5
  • "dont are included on .jar": How can I include them into the jar? I want to export all dependencies. – Evgenij Reznik Jun 12 '19 at 09:43
  • In my case, I work with netbeans. I suppose it is possible to create an executable directly, but there is an error in the openjdk version and it is not possible, at least in version 11. I do not know if it is fixed in version 12. – mdrg89 Jun 12 '19 at 10:04
  • If the bug continues, you cant included it on .jar. It's like when develop the app, you indicate the route of librarys on framework, and now you must indicate them too when you use the .jar but with commands, like if you execute it on a terminal – mdrg89 Jun 12 '19 at 10:10