2

I am working on Netbeans apache 11.1. I developed so many desktop programs using java and could run them almost on any computer. But when I moved to JavaFX technology with maven I wanted to redevelop almost the same desktop apps using JavaFX, and everything worked fine into Netbeans 11.1. The problem is when I want to jar my apps and distribute them outside of Netbeans they actually do not work.

I tried everything I did in the past (which worked just fine) for instance: adding Class-Path and setting Main-Class to manifest but still does not work. I searched through a lot of forums and sites but still cannot run my app outside of Netbeans.

My code is as any code combination of JavaFX, Maven, CSS, and FXML. Everything works just fine into Netbeans. The problem is outside of it.

Although I've added openjfx-12.0.2_windows-x64_bin-sdk to windows environment path, when I attempted to run jar that's been generated by Netbeans using cmd I just get this ERROR: javafx runtime components are missing, and are required to run this application. ANY HELP PLEASE?

  • 3
    Your jar doesn't contain the JavaFX classes, and these are not found in the JDK you use to run it either. There are many options to solve this, typically making a fat jar with shade plugin. All documented here: https://openjfx.io/openjfx-docs/#modular, section non-modular project/maven. If your project is modular, you can try `javafx:jlink`. Check also this [question](https://stackoverflow.com/questions/56196117/how-to-execute-java-fx-11-jar-without-providing-vm-args-via-cmd/). – José Pereda Aug 27 '19 at 11:58
  • Show your `POM` file. – SedJ601 Aug 28 '19 at 15:09

1 Answers1

0

I don't know if I'm understanding your problem right (if not I'm sorry).

Runnable JAR JavaFX

What once helped me, was create a new run configuration (in intellij) with the main class and the JRE. After that I created a Run Maven Goal with the command line

assembly:single
poisn
  • 437
  • 2
  • 17