为了使用 webview amazoncorretto 8 (32bit)
,我想构建 32bit openjfx
。我可以创建一个库,但是当我使用它时,我得到一个UnsatisfiedLinkError
.
参考以下 URL 构建它。
https://dzone.com/articles/how-to-build-openjfx-8-on-windows-from-source
- Visual Studio :社区 ⇒ 专业
- 它的目标是 32 位
注意:在 64 位上构建时没有发生错误。
示例代码:
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("&", "&").replace("<", "<");
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);
}
}
错误:
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