tsmith18256
tsmith18256

Reputation: 647

Some JavaFX Imports Cannot Be Resolved in Eclipse

I am creating a small JavaFX library and have run into some issues with the imports. I have been doing my programming on both my PC and my laptop by just hosting the Eclipse Workspace on Dropbox and everything was working fine. I installed e(fx)clipse on both machines and have been making a JavaFX program for a couple months now with no issues.

Now, I recently started a new project on my laptop that was also working fine; however, when I went to my PC, I discovered a bunch of "The import _____ cannot be resolved" errors.

The weird thing is, most of the javafx classes are importing fine, it just seems that some classes in the javafx.scene.control package are having issues. In the one class I have so far, I am importing these JavaFX classes:

import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.stage.FileChooser;

They all work fine except for three: javafx.scene.control.ButtonType, javafx.scene.control.Dialog, and javafx.scene.control.DialogPane.

I have done quite a bit of research and tried the following with no success:

Nothing seems to be working and I do not understand how just some classes in the package could be missing on one computer. Does anybody have a solution for this?

Upvotes: 9

Views: 5922

Answers (2)

tsmith18256
tsmith18256

Reputation: 647

Okay well I figured this out about 5 minutes after posting the question... of course.

I looked through my installed Java builds under Program and Features on both computers. They looked the same, but I realized that my laptop is on Java 8u40, while my PC is on Java 8u25. I looked at the JavaDocs for javafx.scene.control.Dialog and, sure enough, it is labelled as @since JavaFX 8u40 so I am installing the new JDK now.

Upvotes: 9

ACV
ACV

Reputation: 10561

You need:

javafx-dialogs-x.x.x.jar

and

javafx-ui-controls.jar

Described here: enter link description here

Upvotes: -1

Related Questions