Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX is not recognized in Eclipse

Tags:

eclipse

javafx

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. http://bugs.sun.com/bugdatabase/view_bug.do?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?

like image 838
Matt Avatar asked Mar 23 '13 22:03

Matt


People also ask

How do I fix JavaFX error?

If this is your case also, you can do fix this by simply right-clicking on the javaFX project folder-> Build Path-> Configure Build Path-> Select JavaFX SDK-> Remove library-> Select classpath -> add library-> user library-> select library-> apply. Save this answer.

How do I know if JavaFX is installed in Eclipse?

To verify if JavaFX has been installed in Eclipse, Open New Project window (Main Menu -> New -> Project) Java FX should be listed under wizards.

Can we run JavaFX in Eclipse?

Create an Eclipse User Library - In Eclipse, create a user library representing JavaFX by selecting Window → Preferences (for PC) and Eclipse → Preferences... (for Mac). Continue by selecting Java → Build Path → User Libraries → New... In the textfield, enter a library name (e.g., JavaFX) and select OK.


2 Answers

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?

like image 89
tomsontom Avatar answered Oct 17 '22 02:10

tomsontom


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).

like image 13
ZiglioUK Avatar answered Oct 17 '22 00:10

ZiglioUK