openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+
https://openjfx.io/
BSD 3-Clause "New" or "Revised" License
361 stars 62 forks source link

[Solution in comments] Error when running distribution #31

Closed verycreativename123 closed 5 years ago

verycreativename123 commented 5 years ago

I've built a simple project using Gradle and JavaFX with this plugin. gradle run works fine and runs my app. gradle build produces a .zip of my project in build/distributions. When I open the zip I see a bin folder and a lib. The lib folder contains a ton of jars, including javafx-base, javafx-controls, and so forth. The bin folder contains a Unix executable. When I run this Unix executable (I'm on a Mac), I receive the following error:

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

Yet, everything runs fine when I run via gradle run.

What am I missing?

verycreativename123 commented 5 years ago

I found the solution here: https://github.com/javafxports/openjdk-jfx/issues/236

In short, the main entry point cannot extend from Application. The workaround is to create a different main class that then calls the JavaFX main class.