Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Uninstalled and reinstalled e(fx)clipse
  • Manually added the jfxrt.jar file to the project
  • Cleaned, rebuilt, and refreshed the project several times
  • Removed the JRE from the build path and re-added it
  • Recreated the project using New>JavaFX Project and copying the code over

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?

like image 473
tsmith18256 Avatar asked Apr 08 '15 21:04

tsmith18256


1 Answers

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.

like image 108
tsmith18256 Avatar answered Oct 28 '22 04:10

tsmith18256