NativeLibLoader - installLibraryFromResource - RuntimeImage
Kevin Rushforth
kevin.rushforth at oracle.com
Thu Jul 26 12:42:08 UTC 2018
Hi Steve,
Seems it will be an easy bug for Johan to fix, but I'm curious about how
you created your custom image. The jmods are more suitable for that
approach, since their purpose is to be used with jlink to create a
custom image, in which case the native libraries will be linked into the
image. Maybe I'm missing some use case, though.
-- Kevin
On 7/26/2018 2:46 AM, Johan Vos wrote:
> Hi Steve,
>
> That looks like a bug. The libPrefix and libSuffix are indeed not set in
> cases where usingModules is true, which is only the case when the jrt
> protocol is used.
> It seems to me the prefix/suffix should always be computed. It doesn't look
> right that they are computed inside the loadLibraryFullPath. But it looks
> even worse that the "reallib" is calculated based on statements that might
> not be reached, where it could have used System.mapLibraryName()
>
> I'll create an issue and a PR to fix this.
>
> Thanks for reporting,
>
> - Johan
>
>
> On Thu, Jul 26, 2018 at 11:03 AM Steve Hruda <steve.hruda at gmail.com> wrote:
>
>> Hi,
>> I created a custom runtime image (windows x64) for my JavaFX application
>> and used the OpenJFX 11-ea+19 maven artifacts.
>>
>> I get the following exception if I try to execute my application:
>>
>> Graphics Device initialization failed for : d3d, sw
>> Error initializing QuantumRenderer: no suitable pipeline found
>> java.lang.RuntimeException: java.lang.RuntimeException: Error initializing
>> QuantumRenderer: no suitable pipeline found
>> at
>>
>> javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
>> at
>>
>> javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
>> at
>> javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:263)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:157)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
>> at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>> at
>>
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> at
>>
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:564)
>> at
>>
>> java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:941)
>> Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer:
>> no suitable pipeline found
>> at
>>
>> javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
>> at
>>
>> javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
>> at java.base/java.lang.Thread.run(Thread.java:844)
>> Exception in thread "main" java.lang.reflect.InvocationTargetException
>> at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>> at
>>
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> at
>>
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:564)
>> at
>>
>> java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:941)
>> Caused by: java.lang.RuntimeException: No toolkit found
>> at
>> javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:263)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:157)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
>> at
>>
>> javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
>> ... 5 more
>>
>>
>> -Djavafx.verbose=true shows that JavaFX isn't able to load the native libs
>> from the javafx-graphics jar.
>>
>>
>> I debugged the NativeLibLoader and loadLibraryFromResource and
>> installLibraryFromResource will be executed which is ok. But the
>> *reallib *value for
>> all dll's is wrong because of the empty *libSuffix*.
>>
>> e.g. the reallib value of *api-ms-win-core-console-l1-1-0* is
>> */api-ms-win-core-console-l1-1-0* and not
>> */api-ms-win-core-console-l1-1-0.dll*
>>
>> Is it intentional that *libPrefix *& *libSuffix *will not be set in case of
>> the jrt protocol ?
>>
>>
>> https://github.com/javafxports/openjdk-jfx/blob/c168ab56accd7e74d53737bc0832495dbc318e52/modules/javafx.graphics/src/main/java/com/sun/glass/utils/NativeLibLoader.java#L308
>>
>>
>>
>>
>> https://github.com/javafxports/openjdkjfx/blob/c168ab56accd7e74d53737bc0832495dbc318e52/modules/javafx.graphics/src/main/java/com/sun/glass/utils/NativeLibLoader.java#L338
>>
>>
>>
>>
>> Best Regards,
>> Steve
>>
More information about the openjfx-dev
mailing list