Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Java 11 e4 application :IllegalAccessError(IllegalAccessError: class com.sun.glass.ui.Screen and com.sun.javafx.scene.control.ContextMenuContent)
Java 11 e4 application :IllegalAccessError [message #1822245] Mon, 02 March 2020 12:32 Go to next message
Vincent Bonnafous is currently offline Vincent BonnafousFriend
Messages: 3
Registered: February 2020
Junior Member
Hello everyone,

I migrate a big e4 application to java 11, efxclipse 3.6.2 and openjfx 11.0.2

I have two illegalAccesError:
java.lang.IllegalAccessError: class core.client.application.fx.ui.addons.WindowPlacerAddon (in unnamed module @0x2ed84910) cannot access class com.sun.glass.ui.Screen (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to unnamed module @0x2ed84910

-> Use method Screen.getScreens(); to obtain screen add open my 2 applications windows in each screen

java.lang.IllegalAccessError: class core.client.application.fx.ui.addons.ItemHelperAddon$WidgetListener$1$1 (in unnamed module @0x3f638b30) cannot access class com.sun.javafx.scene.control.ContextMenuContent (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control to unnamed module @0x3f638b30

-> Use to add contextual help in a status bar when hover a item in contextual menu

I'm add this to the VM arguments :
--module-path=/home/bonnafous/opt/java/javafx-sdk-11.0.2/lib
--add-modules=javafx.base,javafx.controls,javafx.graphics,javafx.fxml
--add-exports=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED

This solution :
- does'nt work with an external folder -Defxclipse.java-modules.dir (duplicate module error)
- works with bundled javafx-modules but i prefer a solution with only bundled javafx-modules without using javafx installation path.

Is it possible to export classes Screen and ContextMenuContent with options in the
bundled javafx-modules ?
Re: Java 11 e4 application :IllegalAccessError [message #1822725 is a reply to message #1822245] Thu, 12 March 2020 09:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
are you able to ship your own JDK? Created through jlink? I would suggest to use that strategy because then you just have add --add-modules
Re: Java 11 e4 application :IllegalAccessError [message #1822733 is a reply to message #1822725] Thu, 12 March 2020 12:06 Go to previous messageGo to next message
Vincent Bonnafous is currently offline Vincent BonnafousFriend
Messages: 3
Registered: February 2020
Junior Member
No, i can't ship my own JDK.
Re: Java 11 e4 application :IllegalAccessError [message #1822754 is a reply to message #1822733] Thu, 12 March 2020 22:33 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
so what would be your preferred shipment method? If you want to use our adapter-hooks you can add open/exports through manifest headers
Re: Java 11 e4 application :IllegalAccessError [message #1823010 is a reply to message #1822754] Wed, 18 March 2020 06:39 Go to previous messageGo to next message
Vincent Bonnafous is currently offline Vincent BonnafousFriend
Messages: 3
Registered: February 2020
Junior Member
The JDK is already installed on the target machine.
I don't know how to use adapter-hooks.
But I've found another solution. I replaced the use of classes that are not exported
Re: Java 11 e4 application :IllegalAccessError [message #1823041 is a reply to message #1823010] Wed, 18 March 2020 15:10 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
Using public APIs is naturally always the best solution
Previous Topic:Suggested Changes to Install Guidance
Next Topic:Populate TableView with ObservableMap
Goto Forum:
  


Current Time: Fri Sep 18 18:16:41 GMT 2020

Powered by FUDForum. Page generated in 0.02003 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top