0

I've made a project using JavaFX 8 (built-in JDK8), everything works fine when I compile it in my IDE (Intellij), but when I export it to a runnable .jar, it gives me an error saying the main class can't be found.

I created another class, called run to use it as the main class (i heard Intellij find problems with the main class if it extends Application or any other class), and call the real Main class in it (the one who extends Application).

I also made sure to select it during the choosing of Main class while building the .jar file, as the picture below shows, but still, I got that error when I run my program using CMD.

Does anyone have any idea what I'm doing wrong?

enter image description here

jewelsea
  • 150,031
  • 14
  • 366
  • 406
zaranoa
  • 9
  • 2
  • 1
    I do not recommend using the IntelliJ Idea IDE's built-in artifact system to package your application. I do not recommend using Java 8 for your development or deployment. I recommend using JavaFX 16+. I recommend following the instructions for Runtime Images at [openjfx.io](https://github.com/openjfx/samples/tree/master/CommandLine/Non-modular/Maven/hellofx) or in [this answer](https://stackoverflow.com/a/68823040/1155209). I suggest you use the [openjfx non-modular maven project](https://github.com/openjfx/samples/blob/master/CommandLine/Non-modular/Maven/hellofx/pom.xml) as a template. – jewelsea Aug 20 '21 at 21:40
  • 1
    Edit your question to include a [mcve] (make sure it is minimal and complete so somebody could copy and paste it to run it without change by following your instructions to replicate the issue). Provide more detailed instructions that somebody could follow. You do not need a separate `run` class. Follow Java naming conventions (google them). When you get an error, provide the full exception stack trace in the question. – jewelsea Aug 20 '21 at 21:56
  • don't repost a question, instead edit the previous to make it https://stackoverflow.com/questions/68866574/runnable-jar-from-a-javafx-8-project-javafx-compenents-are-missing – kleopatra Aug 21 '21 at 08:05
  • okay, sorry, i thought they are kind of considered two different questions, i ll try to avoid that next time. – zaranoa Aug 21 '21 at 09:36

0 Answers0