BurningBird
BurningBird

Reputation: 1

JavaFX wont import

Ok...

...and a dozen of other combinations to set the classpath to include the javafx -jars All i get is:

GUI.java:2: error: package javafx.application does not exist

What is wrong?

I'm using Java 11.0.5, Ubuntu and Emacs.

Upvotes: 0

Views: 567

Answers (1)

Cubic
Cubic

Reputation: 15673

The JFX SDK you downloaded contains .jar files. You need to put those jars (or at least the ones you need) on the classpath, not the directory containing them. So for example for javafx.application.Application you’d need -classpath lib/javafx.graphics.jar.

Alternatively, you could use Java's module system with something like

javac --module-path lib --add-modules javafx.graphics GUI.java

Upvotes: 2

Related Questions