如何将 Chromium Embedded Framework (CEF) 与 java 集成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21192279/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to integrate Chromium Embedded Framework (CEF) with java
提问by Amogh
I'd like to make a desktop application to let a website be browsed, I don't want to make a browser but a Browser embeded Application. I've tried with JavaFx
but I've found some problems like missing support for plugins (eg: flash, pdf viewer, etc).
我想制作一个桌面应用程序来浏览网站,我不想制作浏览器,而是制作浏览器嵌入的应用程序。我试过,JavaFx
但我发现了一些问题,比如缺少对插件的支持(例如:flash、pdf 查看器等)。
After lots of search i found Chromium Embedded Framework (CEF) or JCEFJava wrapper for CEF but i don't know how to use it in java to start with.What are the dependencies?How i can start development (POC) using netbeans
?
经过大量搜索,我找到了 CEF 的 Chromium Embedded Framework (CEF) 或JCEFJava 包装器,但我不知道如何在 Java 中使用它netbeans
。
Is it possible to embed CEF/JCEF in java application?
是否可以在 Java 应用程序中嵌入 CEF/JCEF?
采纳答案by Tho
Is it possible to embed CEF/JCEF in java application?
是否可以在 Java 应用程序中嵌入 CEF/JCEF?
Yes, you can do that!
是的,你可以这样做!
Please following these steps:
请按照以下步骤操作:
Download JCEF and extract it JCEF
Declare Environment Variable to point to
${EXTRACT_DIR}/bin/lib/win64
Install following files in local repository:
${EXTRACT_DIR}/bin/{gluegen-rt.jar, gluegen-rt-natives-windows-amd64.jar, jogl-all.jar, jogl-all-natives-windows-amd64.jar, jcef.jar}
.Example:
mvn install:install-file -Dfile=gluegen-rt.jar -DgroupId=org.jcef -DartifactId=gluegen -Dversion=1.0 -Dpackaging=jar
Create a maven project and declare installed artifacts in pom.xml
Copy sample:
${EXTRACT_DIR}/bin/tests/simple/MainFrame.java
to your project and try it
下载 JCEF 并解压JCEF
声明要指向的环境变量
${EXTRACT_DIR}/bin/lib/win64
在本地存储库中安装以下文件:
${EXTRACT_DIR}/bin/{gluegen-rt.jar, gluegen-rt-natives-windows-amd64.jar, jogl-all.jar, jogl-all-natives-windows-amd64.jar, jcef.jar}
.例子:
mvn install:install-file -Dfile=gluegen-rt.jar -DgroupId=org.jcef -DartifactId=gluegen -Dversion=1.0 -Dpackaging=jar
创建一个 Maven 项目并在 pom.xml 中声明已安装的工件
复制示例:
${EXTRACT_DIR}/bin/tests/simple/MainFrame.java
到您的项目并尝试
Take note that those steps are for Maven Projectand JVM 64bit
请注意,这些步骤适用于Maven 项目和JVM 64 位
回答by Amogh
I found an sample application of jcef.
我找到了一个 jcef 的示例应用程序。
To download this Sample Application Click Here
要下载此示例应用程序,请单击此处
回答by smac89
I have a repository that maintains releases for each version of JCEF. The builds are done for different architectures and OS (mac, linux, and windows).
我有一个存储库,用于维护 JCEF 的每个版本的发布。构建是针对不同的体系结构和操作系统(mac、linux 和 windows)完成的。
https://github.com/jcefbuild/java-cef-build/releases
https://github.com/jcefbuild/java-cef-build/releases
Depending on your target OS and architecture, each zip contains jars which need to be placed on the classpath of your java application. They also contain native libraries which need to be loaded by your application by setting java.library.path
to point to the folder containing the binaries.
根据您的目标操作系统和架构,每个 zip 都包含需要放置在 Java 应用程序的类路径上的 jar。它们还包含需要由您的应用程序加载的本机库,方法是设置java.library.path
为指向包含二进制文件的文件夹。
The zips also contain a test application which can be executed by running a script also found in the folder.
zip 文件还包含一个测试应用程序,可以通过运行也在文件夹中找到的脚本来执行该应用程序。