如何将 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 07:12:27  来源:igfitidea点击:

How to integrate Chromium Embedded Framework (CEF) with java

javachromiumchromium-embedded

提问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 JavaFxbut 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:

请按照以下步骤操作:

  1. Download JCEF and extract it JCEF

  2. Declare Environment Variable to point to ${EXTRACT_DIR}/bin/lib/win64

  3. 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

  4. Create a maven project and declare installed artifacts in pom.xml

  5. Copy sample: ${EXTRACT_DIR}/bin/tests/simple/MainFrame.javato your project and try it

  1. 下载 JCEF 并解压JCEF

  2. 声明要指向的环境变量 ${EXTRACT_DIR}/bin/lib/win64

  3. 在本地存储库中安装以下文件: ${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

  4. 创建一个 Maven 项目并在 pom.xml 中声明已安装的工件

  5. 复制示例:${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.pathto 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 文件还包含一个测试应用程序,可以通过运行也在文件夹中找到的脚本来执行该应用程序。