Setup a JavaFx configuration for JDK 17 and the last version of Eclipse [message #1868829] |
Tue, 23 July 2024 09:00  |
Eclipse User |
|
|
|
Good morning,
I'm doing a major migration of an Eclipse RCP 4/JavaFx application.
The source application is in Java 8 under Eclipse Oxygen.
It must be migrated to JDK 17 and the latest stable version of Eclipse.
A large part of the migration has been completed and here I am stuck on the correct configuration of JavaFx.
To analyze and understand my problem, I started with a very small test application.
From the "New Plug-in Project" Wizard, I create a simple Eclipse RCP application, with just a view and a menu.
1. An extract from my Target platform file:
<location includeAllPlatforms="false" includeConfigurePhase="true"
includeMode="slicer" includeSource="true" type="InstallableUnit">
<repository
location="https://download.eclipse.org/efxclipse/runtime-released/3.9.0/site/" />
<unit id="org.eclipse.fx.target.rcp4.feature.feature.group"
version="0.0.0" />
<unit id="org.eclipse.fx.target.rcp.feature.feature.group"
version="0.0.0" />
<unit id="org.eclipse.fx.runtime.e4fx.feature.feature.group"
version="0.0.0" />
<unit id="org.eclipse.fx.runtime.min.feature.feature.group"
version="0.0.0" />
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true"
includeMode="slicer" includeSource="true" type="InstallableUnit">
<repository
location="https://downloads.efxclipse.bestsolution.at/p2-repos/openjfx-17/" />
<unit id="openjfx.media.feature.feature.group" version="0.0.0" />
<unit id="openjfx.standard.feature.feature.group" version="0.0.0" />
<unit id="openjfx.swt.feature.feature.group" version="0.0.0" />
<unit id="openjfx.web.feature.feature.group" version="0.0.0" />
</location>
2. In my test application, I modify the SamplePart view to add a JavaFx table.
In these first tests, I did not enter the JavaFx SDK path in the ef(x)clipse plugin preferences.
First test:
I simply add the different JavaFx bundles of the target platform in the Required Plugins section.
Everything is OK there. The application launches fine, the JavaFx view is displayed and a JavaFx dialog box too.
No error, just a warning from JavaFx:
Quote:
Jul 23, 2024 10:04:17 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @75308740'

Second test: I complicate my application a little.
I add a class in which a UiSynchronize must be injected.
I want this UiSynchronize to be injected by: org.eclipse.fx.ui.di.interopt
@Reference(service = UISynchronize.class, unbind = "-")
private void setUISynchronize(UISynchronize uiSync) {
this.uiSync = uiSync;
}
The application launches fine, view OK, dialog box OK.
On the other hand, the injection of the UiSynchronize reference fails. org.eclipse.fx.ui.di.interopt fails to activate
Quote:
Caused by: java.lang.ClassNotFoundException: javafx.scene.Parent cannot be found by org.eclipse.fx.ui.di.interopt_3.9.0.202210170008
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:536)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
... 38 more
It seems to me that the problem is linked to the fact that the JavaFx libraries are not in the module-path.
I tested several arguments in the run configuration but without success.
In a second series of tests, I tried to run my application by entering the JavaFx 11 + SDK variable in the preferences,
but the result is even less good.

To really start from scratch, I tried to start with a new install of Eclipse and follow this tutorial:
https://tomsondev.bestsolution.at/2020/01/28/setting-up-efxclipse-rcp-development-for-java11-and-pde/
The tutorial fails from the phase: Setup to TargetPlatform, you need JDK 11 and I have to work in JDK 17+
Do any of the forum members know what configuration I need to set to make my test application work?
Thanks for your help.
|
|
|
Re: Setup a JavaFx configuration for JDK 17 and the last version of Eclipse [message #1868847 is a reply to message #1868829] |
Tue, 23 July 2024 14:48  |
Eclipse User |
|
|
|
I continue my tests always inspired by this tutorial:
https://tomsondev.bestsolution.at/2020/01/28/setting-up-efxclipse-rcp-development-for-java11-and-pde/
1. I fixed the target platform problem. This did not work using the Eclipse creation wizard.
I simply edited a .target file and I managed to make a target platform similar to the one in the tutorial.
2 I configured the variable: JavaFx 11 + SDK in the JavaFx preferences.
3. I added this parameter in my launch configuration: -Dosgi.framework.extensions=org.eclipse.fx.osgi -Defxclipse.java-modules.dir=C:\tools\jdks\javafx-sdk-17.0.11 \lib
The injection of UiSynchronize into my service is done successfully, and my service starts.
On the other hand, my application no longer starts with this exception
Quote:
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
Exception in Application start method
!SESSION 2024-07-23 16:31:53.126 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.10
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_FR
Framework arguments: -product fr.javafx.product -clearPersistedState
Command-line arguments: -product fr.javafx.product -data C:\projets\pouet3\workspace/../runtime-fr.javafx.product -dev file:C:/projets/pouet3/workspace/.metadata/.plugins/org.eclipse.pde.core/fr.javafx.product/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -clearPersistedState
!ENTRY org.eclipse.equinox.app 4 0 2024-07-23 16:32:03.494
!MESSAGE Exception in Application start method
!STACK 0
java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: org.eclipse.e4.core.di.InjectionException: Unable to process "GraphicsLoaderImpl.logger": no actual value was found for the argument "Logger[@org.eclipse.fx.core.log.Log("")]".
at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:461)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:452)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:131)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:386)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:313)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
at org.eclipse.fx.ui.workbench.fx.E4Application.preLifecycle(E4Application.java:287)
at org.eclipse.fx.ui.workbench.base.AbstractE4Application.createE4Workbench(AbstractE4Application.java:279)
at org.eclipse.fx.ui.workbench.fx.E4Application.initE4Workbench(E4Application.java:385)
at org.eclipse.fx.ui.workbench.fx.E4Application$1.run(E4Application.java:234)
at org.eclipse.fx.ui.workbench.fx.E4Application.jfxStart(E4Application.java:273)
at org.eclipse.fx.ui.workbench.fx.DefaultJFXApp.start(DefaultJFXApp.java:62)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
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:184)
... 1 more
I found this error on this forum in this Thread:
https://www.eclipse.org/forums/index.php/t/1107782/
But I don't see a solution to this issue.
Thanks for your help.
[Updated on: Tue, 23 July 2024 14:48] by Moderator Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03588 seconds