gpt4 book ai didi

java - JCEF 与 JavaFX fatal error

转载 作者:行者123 更新时间:2023-12-01 09:17:10 26 4
gpt4 key购买 nike

我正在尝试让 JCEF 在简单 JavaFX 应用程序的 swingNode 中工作

public class MainApp extends Application {

@Override
public void start(Stage stage) throws Exception {

SwingNode swingNode = new SwingNode();

SwingUtilities.invokeAndWait(() -> {
String startURL = "https://www.google.com/";
boolean useOSR = OS.isLinux();
boolean isTransparent = false;

CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = useOSR;

CefApp cefApp_ = CefApp.getInstance(settings);
CefClient client_ = cefApp_.createClient();
CefBrowser browser_ = client_.createBrowser(startURL, useOSR, isTransparent);
Component browerUI_ = browser_.getUIComponent();

JPanel panel = new JPanel();
panel.setSize(800, 600);
panel.add(browerUI_, BorderLayout.CENTER);

swingNode.setContent(panel);
});

stage.setScene(new Scene(new javafx.scene.Group(swingNode)));
stage.show();
}

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

我在 client_.createBrowser(startURL, useOSR, isTransparent); 处遇到 fatal error

initialize on Thread[AWT-EventQueue-0,6,main] with library path /path/to/jcef/lib/linux64
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f3d07fced50, pid=22843, tid=0x00007f3ca5991700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_111-b14) (build 1.8.0_111-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.111-b14 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [ld-linux-x86-64.so.2+0x9d50]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /path/to/jcef-javafx-maven/hs_err_pid22843.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#

但是,提供的 JCEF awt 测试示例可以完美运行。

JCEF Version = 3.2840.147
CEF Version = 3.2840.1511
Chromium Version = 54.0.2840.59
Oracle JDK version = 1.8.0_111

edit1:深入研究jcef java代码, fatal error 发生在CefBrowserOsr.java第134行

private void createGLCanvas() {
GLProfile glprofile = GLProfile.getMaxFixedFunc(true); // here

edit2:错误日志hs_err_pid.log content .

最佳答案

升级到 JOGL 2.3.2 并再次重建 JCEF 部分解决了问题(不再发生 jvm 崩溃)

但是,似乎 SwingNode 不会渲染像 GLCanvas 这样非常复杂的东西,reference .

关于java - JCEF 与 JavaFX fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40461907/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com