我似乎不断地碰壁,使 Chrome 与JCEF一起运行。我可以找到本机函数,但仍然无法完成初始化。我设置了LD_PRELOAD变量。我同时运行MainFrame.java类和自定义Scala代码,并且在每一个中都遇到相同的问题。有办法解决吗?
系统:
结构和配置:
一切都在二进制分布结构下。我将jars作为库导入,将本机库路径添加到jcef jar中,并将其导入到我的项目中。
我使用环境变量设置运行配置:
我所有的库和* .pak文件都与chrome沙箱和助手位于同一个目录中,以及libcef.so所在的子目录(二进制发行版)中。
代码和错误
代码在执行以下操作后失败:
println("Generating Handlers")
CefApp.addAppHandler(Handlers.getHandlerAdapter)
private var settings = new CefSettings
settings.windowless_rendering_enabled = useOSR
println("Starting App")
private final val cefApp : CefApp = if(commandLineArgs != null && commandLineArgs.size > 0) CefApp.getInstance(ChromeCommandLineParser.parse(commandLineArgs)) else CefApp.getInstance(settings)
println("Creating Client")
private final val client : CefClient = cefApp.createClient()
输出结果如下:
Starting
Generating Handlers
Starting App
Creating Client
initialize on Thread[AWT-EventQueue-0,6,main] with library path /home/XXXXX/jcef/src/binary_distrib/linux64/bin/lib/linux64
[0413/135633:ERROR:icu_util.cc(157)] Invalid file descriptor to ICU data received.
[0413/135633:FATAL:content_main_runner.cc(700)] Check failed: base::i18n::InitializeICU().
#0 0x7ff8fa94a62e base::debug::StackTrace::StackTrace()
#1 0x7ff8fa95f88b logging::LogMessage::~LogMessage()
#2 0x7ff8fd7588d4 content::ContentMainRunnerImpl::Initialize()
#3 0x7ff8fa857962 CefContext::Initialize()
#4 0x7ff8fa85775b CefInitialize()
#5 0x7ff8fa80a9b8 cef_initialize
#6 0x7ff8d6946914 CefInitialize()
#7 0x7ff8d690200f Java_org_cef_CefApp_N_1Initialize
#8 0x7ff8de207994 <unknown>
感谢所有帮助。谢谢
最佳答案
我也有很多问题,直到我在"icudtl.dat"
而不是"natives_blob.bin"
下创建到"snapshot_blob.bin"
,$jdk/bin directory
和$jdk/jre/bin
的符号链接。
现在,我不再收到此错误。
在https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding中使用示例
我改变了这个...
$ sudo ln -s /path/to/java-cef/src/third_party/cef/linux64/Resources/icudtl.dat /usr/lib/jvm/java-8-oracle/jre/bin/icudtl.dat
$ sudo ln -s /path/to/java-cef/src/third_party/cef/linux64/Debug/natives_blob.bin /usr/lib/jvm/java-8-oracle/jre/bin/natives_blob.bin
$ sudo ln -s /path/to/java-cef/src/third_party/cef/linux64/Debug/snapshot_blob.bin /usr/lib/jvm/java-8-oracle/jre/bin/snapshot_blob.bin
为此...
$ sudo ln -s /path/to/java-cef/src/third_party/cef/linux64/Resources/icudtl.dat /usr/lib/jvm/java-8-oracle/bin/icudtl.dat
$ sudo ln -s /path/to/java-cef/src/third_party/cef/linux64/Debug/natives_blob.bin /usr/lib/jvm/java-8-oracle/bin/natives_blob.bin
$ sudo ln -s /path/to/java-cef/src/third_party/cef/linux64/Debug/snapshot_blob.bin /usr/lib/jvm/java-8-oracle/bin/snapshot_blob.bin