3

I created a Java 9 project in Eclipse, generated a module-info.java and added some test-dependencies, everything works.

But if I add requires javafx.base, it says "javafx.base cannot be resolved to a module". JavaFX does not show up in the class path.

I tried creating a JavaFX project using the JavaFX project template in eclipse using various Java versions, same problem. It adds a library called "JavaFX SDK", but it only conatins on jar file ("org.eclipse.fx.ide.css.jfx8_3.0.0.201705220750.jar") with only the manifest and no classes.

I have tried it with Oxygen.3 with the e(fx)plugin installed as well as a fresh Eclipse Photon install. Both do not work. The only thing that resolves the issue is to switch back to openjdk-8-jdk and to use JavaFX 8.

How do I get JavaFX 9 to work?

piegames
  • 975
  • 12
  • 31
  • Might be related to https://issues.apache.org/jira/projects/MCOMPILER/issues/MCOMPILER-330 – Robert Scholte Mar 25 '18 at 17:48
  • @RobertScholte I just found out this isn't a Maven problem (see my edited question) – piegames Mar 25 '18 at 18:19
  • 2
    What's wrong with this question? When voting down, please leave a comment _why_ you think this is a bad question so I can improve it. – piegames Mar 25 '18 at 19:24
  • No need for down vote. I switched to eclipse IDE literally yesterday, and found so many difficulties to set up JavaFX project with modules. Also, I've tried JavaFX SDK **and** immediately uninstall the plugin. BETA NetBeans was more friendly on this issue... – zlakad Mar 25 '18 at 20:00
  • Are you sure you have Oracle JDK and not the OpenJDK? The latter doesn't come bundled with JavaFX libraries and can cause the problem you are facing. I have Oracle JDK 9.0.4 with Eclipse Oxygen. I can create and run a modular JavaFX application without any problem. – ItachiUchiha Jun 01 '18 at 22:59

1 Answers1

0

Just remove the JavaFX SDK from the build path of your project and you're good to go. This however will only work until Java 10, as Java 11 will not include FX anymore.

Linsane
  • 338
  • 4
  • 16