Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we use JFoenix with Java 11 as is ? #889

Closed
goxr3plus opened this issue Dec 2, 2018 · 16 comments
Closed

Can we use JFoenix with Java 11 as is ? #889

goxr3plus opened this issue Dec 2, 2018 · 16 comments
Labels

Comments

@goxr3plus
Copy link

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

@jjyyxx
Copy link
Contributor

jjyyxx commented Dec 3, 2018

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.

@DJViking
Copy link
Contributor

DJViking commented Dec 3, 2018

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'
}

@goxr3plus
Copy link
Author

goxr3plus commented Dec 3, 2018

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 :)

@jjyyxx
Copy link
Contributor

jjyyxx commented Dec 3, 2018

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.

@DJViking
Copy link
Contributor

DJViking commented Dec 3, 2018

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.

@goxr3plus
Copy link
Author

goxr3plus commented Dec 4, 2018 via email

@jjyyxx
Copy link
Contributor

jjyyxx commented Dec 11, 2018

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.

@mokun
Copy link

mokun commented Jan 1, 2019

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.

@goxr3plus
Copy link
Author

goxr3plus commented May 28, 2019

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

@cetoh
Copy link

cetoh commented Sep 11, 2019

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

@zorenkonte
Copy link

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?

@Duanzihao
Copy link

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.

@MRavandoust
Copy link

MRavandoust commented Apr 17, 2020

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)

@kienkites
Copy link

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?

@SchweinchenFuntik
Copy link

maybe different jdk in the project and the system

@Alex50505
Copy link

Alex50505 commented Dec 8, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests