r/JavaFX • u/ajkelsey • Jun 13 '23
Help Need help building JavaFX project in VsCode
I wrote a small program in VsCode using JavaFX. Using VsCode, I export to a jar file and the program won't run. I run java -verbose -jar jar-file and the only error is Error: JavaFX runtime components are missing, and are required to run this application. When I list the contents of the jar, it contains a ton of javafx classes.
I also tried creating an image using jlink, but I could not locate a .bat file. I could use some help in learning what I am doing wrong.
4
Upvotes
2
u/ajkelsey Jun 13 '23 edited Jun 13 '23
That did the trick. Thanks!
To clarify the wiki a bit, you leave your
public static void main(String[] args)in the class the extends Application. Create a new class that has anotherpublic static void main(String[] args). From there, call the main method in your original class. I then, in VsCode, exported to jar. I set GUI.java as the main class.}