3

Even though I've installed ec(fx)lipse, Eclipse is unable to resolve any import statements with JavaFX.

I am running Eclipse version 2018-09 (4.9.0) on Ubuntu 18.04.

The Java I'm using is openjdk version "10.0.2". I have also installed OpenJFX.

How can I use JavaFX in Eclipse?

A screenshot of my program: enter image description here

kleopatra
  • 51,061
  • 28
  • 99
  • 211
LuminousNutria
  • 1,883
  • 2
  • 18
  • 44
  • If you use openjdk package from Ubuntu repository, try [installing openjfx](https://stackoverflow.com/a/35956637/2158271). – haba713 Nov 22 '18 at 22:41
  • @haba713 I already have. Unfortunately, it doesn't seem to matter. – LuminousNutria Nov 22 '18 at 22:54
  • This sounds like a classpath headache here. I am wary of instlaling Java11 and screwing up my ability to use JavaFX. – ncmathsadist Nov 22 '18 at 23:05
  • @ncmathsadist Can you suggest anything? – LuminousNutria Nov 22 '18 at 23:08
  • I am flummoxed. I am going to get a spare PC and experiment on it. I don't want to gum up my production environment. – ncmathsadist Nov 22 '18 at 23:18
  • 1
    make sure the fx modules are added to the modulPath (right click project ->build path -> configure -> tab libraries -> select modulpath -> add external jars and then add the fx modules – kleopatra Nov 23 '18 at 09:58
  • .. and search the javafx-11 tag: there's a rather extensive answer to IDE config problem around fx11 – kleopatra Nov 23 '18 at 10:00
  • @kleopatra Thanks! I couldn't figure out where openjfx put it's modules, so I downloaded them. They work though! – LuminousNutria Nov 23 '18 at 17:40
  • @kleopatra Erm, well I thought they did. Turns out Eclipse throws an error. ``Error: Could not find or load main class mainPackage.Main Caused by: java.lang.NoClassDefFoundError: javafx/application/Application`` – LuminousNutria Nov 24 '18 at 01:08

0 Answers0