Reputation: 5778
JavaFX is supposed to be included with the latest release of the JDK. I'm using 1.7 v 17. Imports like:
import javafx.fxml.Initializable;
are not recognized. I would prefer not to have to link to the jar manually.
I heard that this was a bug before, but that it should have been fixed. https://bugs.java.com/bugdatabase/view_bug?bug_id=7166330
Does anyone have an answer on how javafx can be recognized. I don't want to have e(fx)clipe do it for me and I don't want to have to link the jar. As far as I understand, it;s now included in the latest release of the jdk, therefor I should be able to do an import like above right?
Upvotes: 15
Views: 65441
Reputation: 111
Step1 - Remove module-info.java file from your project
Step2 - Set the VM Arguments Click on Run--> Run Configuration --> Arguments
Add Path Like this (my sdk present in documents folder)
--module-path /Users/MICROSOFT/Documents/javafx-sdk-17.0.6/lib --add-modules javafx.controls,javafx.fxml
Upvotes: 0
Reputation: 2610
On Ubuntu 14.10 I had to install first openjfx
sudo apt-get install openjfx
then I created a default project using e(fx)clipse and the default JRE (java-8-openjdk-amd64).
Upvotes: 13
Reputation: 204
You can add the "jfxrt.jar" manually! Its in the installed JDK. Example:
Copy the jar file and put it to a subfolder in the project (for example, / lib).
Now add the "jfxrt.jar" to the classpath. Click the right mouse button on the project and select from Properties -> Java Build Path -> Libraries -> Add JARs from ... and add the jar file.
Upvotes: 6
Reputation: 5887
JavaFX isn't on any of the default classpaths in JDK7 - please see in which version the bug has been fixed!
In JDK8 this is fixed and JavaFX is on the ExtensionClasspath but still you'll get warnings from Eclipse because stuff on the extension classpath is considered an implementation detail - you'll can fix this yourself in the JRE-Runtimes.
What's your problem with e(fx)clipse? It would fix all your problems no matter if you develop against JDK7 or JDK8?
Upvotes: 13