如何启用/允许Java在CefSharp应用程序中运行
问题描述:
我们正在制作一个Web浏览器来试验Oracle的ADT/Forms技术。所有它需要做的就是去网址并运行Java applet。如何启用/允许Java在CefSharp应用程序中运行
我正在使用(试图至少)CefSharp3(来自https://github.com/cefsharp/CefSharp的新鲜克隆)。
我为此创建了一个WPF项目,让它工作(我可以导航到谷歌,在这里,Oracle等),但是,当我导航到我们的Java小程序时,我似乎只得到一个空白屏幕。
我已经设置浏览器的属性
- “JavaDisabled”
- 适当 “PluginsDisabled”
- “WebSecurityDisabled”
(在抓救命稻草那里!)和我还是只看到一个空白的屏幕。
我想知道如果应用程序没有权限的JRE?也许JRE需要包含在项目中?
这是调试文件的结果
[1011/121439:WARNING:resource_bundle.cc(280)] locale_file_path.empty()
[1011/121439:WARNING:resource_bundle.cc(280)] locale_file_path.empty()
[1011/121439:WARNING:resource_bundle.cc(280)] locale_file_path.empty()
[1011/121439:ERROR:renderer_main.cc(226)] Running without renderer sandbox
[1011/121441:WARNING:content_browser_client.cc(480)] No browser info matching view process id 3 and routing id 2
[1011/121441:WARNING:content_browser_client.cc(480)] No browser info matching view process id 3 and routing id 2
[1011/121441:WARNING:content_browser_client.cc(480)] No browser info matching view process id 3 and routing id 2
[1011/121441:WARNING:resource_bundle.cc(280)] locale_file_path.empty()
[1011/121441:WARNING:content_browser_client.cc(480)] No browser info matching view process id 3 and routing id 2
[1011/121441:WARNING:content_browser_client.cc(480)] No browser info matching view process id 3 and routing id 2
[1011/121441:WARNING:content_browser_client.cc(480)] No browser info matching view process id 3 and routing id 2
的Java小程序工作在火狐,Chrome,IE和铬没问题(即只到Java小程序新鲜运行后)(用的WinForms )。它可能只是因为WPF和Java不会jive。
这是一些代码! - 这并不多,但使用这个框架并不需要太多 - 我对此印象非常深刻。
public partial class MainWindow : Window
{
public MainWindow() {
InitializeCef();
InitializeComponent();
SetBrowserSettings();
((IWebBrowser)webBrowser).Load("URL_To_Java_Applet");
}
private void InitializeCef() {
var settings = new CefSharp.CefSettings()
{
PackLoadingDisabled = true
};
settings.IgnoreCertificateErrors = true; // could be preventing the JRE?
Cef.Initialize(settings);
}
private void SetBrowserSettings() {
BrowserSettings settings = new BrowserSettings();
settings.JavaDisabled = false;
settings.PluginsDisabled = false;
settings.WebSecurityDisabled = true; // desperate attempt to allow JRE to run!
webBrowser.BrowserSettings = settings;
}
}
答
看起来你是对的...
这可能仅仅是因为WPF和Java不合拍。
与WinForms的尝试,而不是WPF那里的前景看起来并不好(注意WPF在OSR模式下运行)
看到这个CEF forum thread
更新:我试着用http://java.com/en/download/installed8.jsp和Win32的构建CefSharp.Winforms | Wpf.Example - 它们都可以像JRE 7.67 x86一样按预期工作。当然,x64示例没有工作,因为我的电脑上没有x64 JRE。
什么CefSharp版本? debug.log中的任何错误?它是一种什么样的url,一个本地文件或http,如果它是一个本地文件,你是否尝试将它上传到web并从那里运行? google.com网址是否正常加载? DevTools中的任何错误? – 2014-10-11 16:10:50
@CzarekTomczak伟大的问题! - 我应该预料到他们。我将用您正在查找的信息更新我的问题。 – 2014-10-11 16:17:15
'locale_file_path.empty()'警告 - 看起来像缺少一些二进制文件。 locales /目录和.pak文件驻留在可执行文件旁边吗? – 2014-10-11 16:35:12