0

As the title says: Somehow java can't find the PropertyValueFactory class, although it is in the system library (as seen in the picture at the link) and I've got no idea why. Other classes from that package are working, just this specific one doesn't... I'm using JDK 9.0.4 with Eclipse 4.7.3

import javafx.scene.control.cell.PropertyValueFactory;

module javafx.controls {
requires transitive javafx.base;
requires transitive javafx.graphics;

And here is module-info.class:

module javafx.controls {
requires transitive javafx.base;
requires transitive javafx.graphics;

exports javafx.scene.chart;
exports javafx.scene.control;
exports javafx.scene.control.cell;
exports javafx.scene.control.skin;

exports com.sun.javafx.scene.control to
    javafx.web;
exports com.sun.javafx.scene.control.behavior to
    javafx.web;
exports com.sun.javafx.scene.control.inputmap to
    javafx.web;
exports com.sun.javafx.scene.control.skin to
    javafx.graphics,
    javafx.web;
}

Screen of the problem

fabian
  • 80,457
  • 12
  • 86
  • 114
Sa'Kagé
  • 51
  • 1
  • 1
  • 4
  • 1
    Post the ([formatted](https://meta.stackoverflow.com/questions/251361)) code in the question; don't post images of code. That way others can copy it and paste it into their own IDEs to see if they see the same issue. See https://meta.stackoverflow.com/q/285551/ – James_D Apr 06 '18 at 20:31
  • It's just an import, but ok... – Sa'Kagé Apr 06 '18 at 20:36
  • Do you have a `module-info.java` file? You have actual imports from the exact same package working? This just seems weird. (Off-topic, a bit, there's really no reason to use that class at all in Java 8 or later: see https://stackoverflow.com/questions/49021198. But still, it should work.) – James_D Apr 06 '18 at 20:39
  • Yes, other classes from that package work, but I didn't check all of them And I got module-info.class (funny, that there is java code in it ^^) And to reply to your off-topic: Isn't that the way to put data in your JavaFX TableView?? (I'm setting the PropertyValueFactory as CellValueFactory for the column) If not, my problem is probably obsolete... – Sa'Kagé Apr 06 '18 at 20:49
  • It's no more verbose (using lambda expressions) and better in many ways (e.g., compile time checking, faster) just to implement the cell factory directly. See the explanation in the linked question. – James_D Apr 06 '18 at 20:51
  • I think you were confused about the question concerning `module-info.java`. I meant "did you define one in your project?" (not "is there one in the library modules", which, of course, there is - several in fact). – James_D Apr 06 '18 at 20:52
  • This just sounds like Eclipse has got confused (unless there is something really weird, such as invisible characters in the middle of your import which got stripped out when you copied and pasted the import into the question). Did you already try cleaning and rebuilding the project? – James_D Apr 06 '18 at 20:54
  • Cleaning, restarting eclipse and rebuilding actually solved the problem ... now I feel dumb -_- Do you want to write a proper answer, so I can set your answer as the correct one? And btw: Thanks for the tip with the lambdas, I think I will try that out – Sa'Kagé Apr 06 '18 at 21:06
  • Ah, I think it's probably no help to the general SO community, so not really worth an answer. I recommend the lambda approach to cell value factories. – James_D Apr 06 '18 at 21:17

0 Answers0