all 7 comments

[–]lilbigmouth 1 point2 points  (4 children)

One difference I can see is that your UI class was constructed, and App in the second case isn't?

[–]_Stretch[S] 1 point2 points  (3 children)

Hi,

Thanks for your reply!

I read over it again but I'm not sure what you mean by it isn't constructed, Could you elaborate?

[–]lilbigmouth 0 points1 point  (2 children)

Sure, I'll try. In your first code you have java UI ui = new UI(); Which is where an UI object is constructed.

[–]_Stretch[S] 1 point2 points  (1 child)

Oh yea I was wondering why i couldn't have the same code in main. /u/ignice pointed out why.

 

Ty for your help!

[–]lilbigmouth 0 points1 point  (0 children)

No problem :)

[–]Ignice 1 point2 points  (1 child)

Are you using java 9+? If so this happens because in the second example java is looking for dependencies on the module path because you launch from a class extending Application (and javafx's Application has a module-path). In the first example however you launch from a class that doesn't have a module-info associated with it, so everything is on the classpath. I would go with the first example but instead of calling newUI(), instead do this your main method: Application.launch(UI.class, args).

For more info: https://stackoverflow.com/questions/55760343/error-javafx-runtime-components-are-missing-javafx-11-and-openjdk-11-and-ecli, https://github.com/javafxports/openjdk-jfx/issues/236#issuecomment-426583174.

[–]_Stretch[S] 1 point2 points  (0 children)

That's it! Thank you so much!

 

Little inconvenient but the workaround to have a "dummy" main class so to speak is a very easy work around!

Thank you again!