0

In order to use webview with amazoncorretto 8 (32bit), I want to build 32bit openjfx. I could create a library, but when I use it I get an UnsatisfiedLinkError.

Build it with reference to the following URL.

https://dzone.com/articles/how-to-build-openjfx-8-on-windows-from-source

  • Visual Studio :Community ⇒ Professional
  • It is targeting 32 bit

Note: No error occurred when building on 64 bit.

Sample Code:

import java.util.Properties;
import java.util.TreeSet;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class SimpleJavaFX8Example extends Application {

    private Stage stg;

    @Override
    public void start(Stage stg) throws Exception {
        this.stg = stg;
        stg.setTitle(getClass().getSimpleName());

        VBox box = new VBox();

        WebView wv = new WebView();
        WebEngine engine = wv.getEngine();

        StringBuilder buf = new StringBuilder();
        buf.append("<table>");
        Properties props = System.getProperties();
        for (String name : new TreeSet<>(props.stringPropertyNames())) {
            String val = props.getProperty(name);
            val = val.replace("&", "&amp;").replace("<", "&lt;");
            buf.append("<tr><td>").append(name).append("</td><td>").append(val).append("</td></tr>");
        }
        buf.append("</table>");

        engine.loadContent("<title>t</title><h1>System Properties</h1>" + buf.toString(), "text/html");
        box.getChildren().add(wv);
        VBox.setVgrow(wv, Priority.ALWAYS);

        stg.setScene(new Scene(box));
        stg.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

Error:

Exception in Application start method
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
        at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.webkit.WebPage.twkInitWebCore(ZZZ)V
        at com.sun.webkit.WebPage.twkInitWebCore(Native Method)
        at com.sun.webkit.WebPage.lambda$static$0(WebPage.java:156)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.webkit.WebPage.<clinit>(WebPage.java:132)
        at javafx.scene.web.WebEngine.<init>(WebEngine.java:881)
        at javafx.scene.web.WebEngine.<init>(WebEngine.java:868)
        at javafx.scene.web.WebView.<init>(WebView.java:273)
        at SimpleJavaFX8Example.start(SimpleJavaFX8Example.java:23)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
        ... 1 more
Exception running application SimpleJavaFX8Example
Naman
  • 27,789
  • 26
  • 218
  • 353
kimomon
  • 1
  • 1
  • Hi @kimomon, did you build x86 OpenJFX yourself, or you used the OpenJFX provided by Corretto8 x86 release? – yoroto Jan 10 '19 at 19:13
  • Hi @yoroto, I built x86 open JFX myself. And it overlay on Corretto8 x86. – kimomon Jan 11 '19 at 06:23
  • Which bootstrap JDK are you using? Webkit is not built by default. JFX will simply copy the webkit library from the bootstrap JDK when Webkit build is not enabled. However if the bootstrap does not have webkit either, then you won’t expect to find it in your build. – yoroto Jan 14 '19 at 22:41
  • Thank you @yoroto. I used OracleJDK. I did not understand. Since jfxwebkit.dll was created, I thought that the webkit option was enabled. The webkit option was enabled. – kimomon Jan 17 '19 at 03:54
  • Hi @kimomon. The jfxwebkit.dll was copied to your build from the OracleJDK. Webkit is one of the case we don't support at the moment. I will try you case next week to see what the problem was. I suspect it is a linking problem. I have created an issue for you in our Github page: https://github.com/corretto/corretto-8/issues/48 – yoroto Jan 26 '19 at 05:16

0 Answers0