eclipse-efx / efxclipse-eclipse

Eclipse Public License 2.0
15 stars 5 forks source link

JavaFX SDK library not added to modulepath #74

Closed arminsteudte closed 4 years ago

arminsteudte commented 4 years ago

When creating a JavaFx project with eclipse 2020-03, openJdk 11 and JavaFX 11 the libraries are not added to the project's classpath. Therefore the project has compiletime errors, hence of the missing classes under the "javafx" package. The issue has already been described in this thread: https://www.eclipse.org/forums/index.php/t/1103256/

It would be very kind to fix this behavior. I'm using the described setup while teaching a computer science course to students. To reduce complexity I would ruther avoid using maven/gradle or any other build tool. So integrating the described solution/fix into e(fx)clipse would save my students from doing lot's of boilerplate configuration. Big Thanks!!

arminsteudte commented 4 years ago

A short follow up. It seems to like the e(fx)clipse adds JavaFX only to the classpath and so every Java version above 8 will not find the jars/modules. Therefore you can take a look into the default run configuration under "dependencies". The Library can be found under Classpath Entries but not under Modulepath Entries. Maybe that's helpful.

tomsontom commented 4 years ago

the launch failed in the installed version because the css-module name was not ok. This is fixed with the next nightly build

arminsteudte commented 4 years ago

Big Thanks for your amazingly quick responser and work @tomsontom.

I tried a simple Hello World Project with fxml as I would do it in a lesson and there are still one minor and a bigger issue. I include the sample project in this post. HelloWorldFX11.zip

In the module-info.java is the require clause missing für "javafx.fxml". Therefore there is a compiler error regarding the FXMLLoader (see screenshot). A simple quickfix does the trick. Maybe this can be easily fixed.

grafik

When I try to run the "quickfixed" project I get the following exception: javafx.fxml.LoadException: /D:/eclipse_2020_03_workspace/HelloWorldFX11/bin/de/igsbuchholz/helloworldfx/HelloWorldFX.fxml:5 at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625) at javafx.fxml/javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:105) at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:943) at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:980) at javafx.fxml/javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:227) at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:752) at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113) at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106) at HelloWorldFX11/de.igsbuchholz.helloworldfx.Main.start(Main.java:14) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.base/java.security.AccessController.doPrivileged(Native Method) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.IllegalAccessException: class javafx.fxml.FXMLLoader$ValueElement (in module javafx.fxml) cannot access class de.igsbuchholz.helloworldfx.HelloWorldFXController (in module HelloWorldFX11) because module HelloWorldFX11 does not export de.igsbuchholz.helloworldfx to module javafx.fxml at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361) at java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99) at java.base/java.lang.Class.newInstance(Class.java:579) at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:936) ... 22 more

I'm no so familiar with the java module system, maybe it is a nother directive I have to add to the module-info. I will investigate it. But maybe you know a trick?

arminsteudte commented 4 years ago

Ok. Adding "javafx.fxml" to the opens clause in module-info.java does the trick. Maybe you could integrate it into the plugin? Should I create a new issue @tomsontom?

Thanks a lot!

tomsontom commented 4 years ago

ok i only tried the simple none FXML project!