JFoenix icon indicating copy to clipboard operation
JFoenix copied to clipboard

Can we use JFoenix with Java 11 as is ?

Open goxr3plus opened this issue 8 years ago • 16 comments

Hello today i am trying to pass some projects on Java 11 is JFoenix ready for that :) ?

goxr3plus avatar Dec 02 '18 21:12 goxr3plus

From my experience, the short answer is yes, but needs some configuration.

As JavaFX is not shipped with Java 11, you first have to setup JavaFX correctly.

If you choose a non-module code structure, things should have been done.

If you use Java 9 Module, some more configuration is needed.

jjyyxx avatar Dec 03 '18 07:12 jjyyxx

I think the 9.x.x version should work with JavaFX 11. You do need the JavaFX though. The easiest approach is using the dependencies from Maven Central.

dependencies {
    compile group: 'org.openjfx', name: "javafx-base", version: '11', classifier: 'linux'
}

DJViking avatar Dec 03 '18 08:12 DJViking

I am using Java11 and set up a module project ... the problem is Eclipse is reporting errors about JFoenix packages not found anymore that's why i asked .....

I figured how to use JavaFX in pom.xml you can see here => https://github.com/goxr3plus/XR3Converter/tree/Java-11

Everything works except JFoenix , well ControlsFX too ( but here is JFoenix repo so...)

How i can configure JFoenix to work with Java 11 ?

@DJViking :)

goxr3plus avatar Dec 03 '18 09:12 goxr3plus

You might be facing the same problem I face several weeks ago. Could you post the error message, then I can confirm if it's the same problem as mine. If yes, I will post the solution.

jjyyxx avatar Dec 03 '18 09:12 jjyyxx

How i can configure JFoenix to work with Java 11 ?

I'm not quite sure with Maven. I moved over to Gradle after Java 9. I do not need to configure anything in my gradle build script to get JFoenix working with Eclipse. implementation(group: 'com.jfoenix', name: 'jfoenix', version: '9.0.8')

Though when generating the eclipse classpath file, it places all dependencies on the classpath and not the modulepath. I fix this by moving them all to the modulepath section in Eclipse.

DJViking avatar Dec 03 '18 19:12 DJViking

Thank you so much for detailed, Eclipse is showing like packages are missing from JFoenix even if i have added it in the pom. xml. as it was in Java 10 :)

On Mon, Dec 3, 2018, 21:03 Sverre Moe <[email protected] wrote:

How i can configure JFoenix to work with Java 11 ?

I'm not quite sure with Maven. I moved over to Gradle after Java 9. I do not need to configure anything in my gradle build script to get JFoenix working with Eclipse. implementation(group: 'com.jfoenix', name: 'jfoenix', version: '9.0.8')

Though when generating the eclipse classpath file, it places all dependencies on the classpath and not the modulepath. I fix this by moving them all to the modulepath section in Eclipse.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jfoenixadmin/JFoenix/issues/889#issuecomment-443829245, or mute the thread https://github.com/notifications/unsubscribe-auth/ATbiwE2m06kHQv99XMzpEljy8iQAIipRks5u1XWNgaJpZM4Y9mU7 .

goxr3plus avatar Dec 04 '18 21:12 goxr3plus

If you face something like

java.lang.IllegalAccessError: class xxx cannot access class xxx (in module javafx.controls) because module javafx.controls does not export xxx to xxx

then you can solve it by adding those jvm arguments as jfoenix build.gradle did. I do not use Maven, but I guess it won't be difficult to adapt those arguments to Maven.

jjyyxx avatar Dec 11 '18 02:12 jjyyxx

then you can solve it by adding those jvm arguments

True. I tweak the VM args to make my app running under openjdk/openjfx 11.

For instance, I add the followings in IntelliJ's Run Configuration inside an application's window's VM-option :

--module-path=D:\[YOUR DIRECTOY\javafx-sdk-11.0.1\lib
--add-modules=javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web
--add-opens
javafx.base/com.sun.javafx.runtime=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.binding=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.event=ALL-UNNAMED
--add-opens
javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED

Granted, in order to make jfoenix works, it should need less and doesn't need all of these.

But in my app, I use controlsfx and other non-Java 11 compliant libraries. You may have to go one by one to find what --add-opens ... you'll need in your case.

mokun avatar Jan 01 '19 17:01 mokun

Guys do you know how i can solve this error with Java11 and JFoenix latest version ?

Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class com.jfoenix.skins.JFXTabPaneSkin (in module com.jfoenix) cannot access class com.sun.javafx.scene.control.behavior.TabPaneBehavior (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control.behavior to module com.jfoenix

@mokun @jjyyxx @DJViking

https://github.com/jfoenixadmin/JFoenix/issues/1005

goxr3plus avatar May 28 '19 11:05 goxr3plus

Guys do you know how i can solve this error with Java11 and JFoenix latest version ?

Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class com.jfoenix.skins.JFXTabPaneSkin (in module com.jfoenix) cannot access class com.sun.javafx.scene.control.behavior.TabPaneBehavior (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control.behavior to module com.jfoenix

@mokun @jjyyxx @DJViking

#1005 Make sure in your module-info.java it specifies opens com.sun.javafx.control.behavior to com.jfeonix If that doesn't work then also add exports com.sun.javafx.control.behavior to com.jfeonix

cetoh avatar Sep 11 '19 22:09 cetoh

then you can solve it by adding those jvm arguments

True. I tweak the VM args to make my app running under openjdk/openjfx 11.

For instance, I add the followings in IntelliJ's Run Configuration inside an application's window's VM-option :

--module-path=D:\[YOUR DIRECTOY\javafx-sdk-11.0.1\lib
--add-modules=javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web
--add-opens
javafx.base/com.sun.javafx.runtime=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.binding=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.event=ALL-UNNAMED
--add-opens
javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED

Granted, in order to make jfoenix works, it should need less and doesn't need all of these.

But in my app, I use controlsfx and other non-Java 11 compliant libraries. You may have to go one by one to find what --add-opens ... you'll need in your case.

Is this workable on maven project?

zorenkonte avatar Dec 19 '19 06:12 zorenkonte

then you can solve it by adding those jvm arguments

True. I tweak the VM args to make my app running under openjdk/openjfx 11.

For instance, I add the followings in IntelliJ's Run Configuration inside an application's window's VM-option :

--module-path=D:\[YOUR DIRECTOY\javafx-sdk-11.0.1\lib
--add-modules=javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web
--add-opens
javafx.base/com.sun.javafx.runtime=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.binding=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.event=ALL-UNNAMED
--add-opens
javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED

Granted, in order to make jfoenix works, it should need less and doesn't need all of these.

But in my app, I use controlsfx and other non-Java 11 compliant libraries. You may have to go one by one to find what --add-opens ... you'll need in your case.

Yes, you are right. But I also want to add a point that when I use Intellij IDEA to run my application, in my VM option, I write it as:

--add-modules=javafx.base --add-modules=javafx.controls --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web

and when I use

--add-modules=javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web

my java throws me an error.

Duanzihao avatar Apr 15 '20 12:04 Duanzihao

Hello I have a problem with JFXTextField in eclips. I use java 14 and javafx14 . in Netbeans i dont have problem but in eclipse i reiceve this error message :

java.lang.IllegalAccessException: class com.jfoenix.skins.JFXTextFieldSkin cannot access a member of class javafx.scene.control.skin.TextFieldSkin (in module javafx.controls) with modifiers "private"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:376)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:647)
	at java.base/java.lang.reflect.Field.checkAccess(Field.java:1073)
	at java.base/java.lang.reflect.Field.get(Field.java:414)
	at com.jfoenix.skins.JFXTextFieldSkin.createPromptNode(JFXTextFieldSkin.java:152)
	at com.jfoenix.skins.JFXTextFieldSkin.lambda$new$1(JFXTextFieldSkin.java:70)
	at com.jfoenix.skins.PromptLinesWrapper.init(PromptLinesWrapper.java:122)
	at com.jfoenix.skins.JFXTextFieldSkin.<init>(JFXTextFieldSkin.java:70)
	at com.jfoenix.controls.JFXTextField.createDefaultSkin(JFXTextField.java:69)
	at javafx.controls/javafx.scene.control.Control.doProcessCSS(Control.java:897)
	at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Control.java:89)
	at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(ControlHelper.java:67)
	at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:145)
	at javafx.graphics/javafx.scene.Parent.doProcessCSS(Parent.java:1400)
	at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Parent.java:125)
	at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(ParentHelper.java:98)
	at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:145)
	at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9542)
	at javafx.graphics/javafx.scene.Scene.doCSSPass(Scene.java:569)
	at javafx.graphics/javafx.scene.Scene.preferredSize(Scene.java:1781)
	at javafx.graphics/javafx.scene.Scene$2.preferredSize(Scene.java:393)
	at javafx.graphics/com.sun.javafx.scene.SceneHelper.preferredSize(SceneHelper.java:66)
	at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1086)
	at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
	at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
	at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1174)
	at javafx.graphics/javafx.stage.Window.show(Window.java:1189)
	at javafx.graphics/javafx.stage.Stage.show(Stage.java:273)
	at application.Main.start(Main.java:18)
	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(AccessController.java:391)
	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:832)
java.lang.NullPointerException
	at com.jfoenix.skins.JFXTextFieldSkin.updateTextPos(JFXTextFieldSkin.java:109)
	at com.jfoenix.skins.JFXTextFieldSkin.layoutChildren(JFXTextFieldSkin.java:93)
	at javafx.controls/javafx.scene.control.Control.layoutChildren(Control.java:601)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1207)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1214)
	at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:576)
	at javafx.graphics/javafx.scene.Scene.preferredSize(Scene.java:1784)
	at javafx.graphics/javafx.scene.Scene$2.preferredSize(Scene.java:393)
	at javafx.graphics/com.sun.javafx.scene.SceneHelper.preferredSize(SceneHelper.java:66)
	at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1086)
	at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
	at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
	at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1174)
	at javafx.graphics/javafx.stage.Window.show(Window.java:1189)
	at javafx.graphics/javafx.stage.Stage.show(Stage.java:273)
	at application.Main.start(Main.java:18)
	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(AccessController.java:391)
	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:832)

MRavandoust avatar Apr 17 '20 14:04 MRavandoust

I have same problem, but when I run it in intellij Gradle - Task - application - run -> everything is fine, but when I try it in console "gradlew run", then show me that error, some body know how to fik it?

kienkites avatar Apr 20 '20 05:04 kienkites

maybe different jdk in the project and the system

SchweinchenFuntik avatar Apr 20 '20 10:04 SchweinchenFuntik

This is so complicated. @jfoenixadmin could you please fix this by embedding the add-opens stuff into JFoenix itself? I love JFoenix but this adds an additional layer of complication that I even want to start using JDK 8 instead of JDK 15, the latest version of Java right now. Plus, the VM options above that are supposed to work don't work in Apache NetBeans IDE 12.2.

Alex50505 avatar Dec 08 '20 21:12 Alex50505