依赖软件参考

本文参考官方网站上的jcef编译过程
编译成功的环境如下:

  • windows 10 64 bit
  • JDK 1.8.0_121 64 bit
  • Python 2.7.13
  • git version 2.12.1.windows.1
  • cmake version 3.12.0-rc1
  • Visual Studio 2015 Enterprise Edition

以上的软件也是官网上要求安装的软件,不过版本稍有不同,官网上的版本要求如下:

  • CMake version 2.8.12.2 or newer.
  • Git.
  • Java version 1.7 or 1.8.
  • Python version 2.6 or newer in the 2.x series (3.x is not supported)

VS官方是建议使用2015版本。

另外在64位机器上编译,jdk最好装64位的,由于64位的机器默认编译64位的依赖,因此,32位jdk找到的依赖会报错,后面会提到出错后的处理

下载jcef源代码

h@DESKTOP-8K18HPL MINGW64 ~
$ cd /d/learn/jecf/

h@DESKTOP-8K18HPL MINGW64 /d/learn/jecf
$ git clone https://bitbucket.org/chromiumembedded/java-cef.git src
Cloning into 'src'…
remote: Counting objects: 3710, done.
remote: Compressing objects: 100% (1758/1758), done.
remote: Total 3710 (delta 2461), reused 2576 (delta 1682)
Receiving objects: 100% (3710/3710), 27.49 MiB | 68.00 KiB/s, done.
Resolving deltas: 100% (2461/2461), done.

h@DESKTOP-8K18HPL MINGW64 /d/learn/jecf
$

执行make

到了这一步就虽然可以执行make了,make过程有个问题make是需要从Google Storage 下载 clang-format,这个步骤执行一次即可;国内的用户需要设置代理才可以,不然会停留在 -- Downloading clang-format from Google Storage... 这一步 输出如下:

-- Found PythonInterp: D:/Python27/python.exe (found version "2.7.13")
-- Found JNI: C:/jdk1.8.0_121_x86/lib/jawt.lib (Required is at least version "1.7")
-- Generating native/jcef_version.h file…
File native/jcef_version.h is already up to date.
-- Downloading clang-format from Google Storage…

执行make 前,设置cmd代理:

set http_proxy=http://{ip}:{port}
set https_proxy=http://{ip}:{port}

执行make,参考下面官网提供的make流程命令

# Enter the JCEF source code directory.
cd /path/to/java-cef/src

# Create and enter the `jcef_build` directory.
# The `jcef_build` directory name is required by other JCEF tooling
# and should not be changed.
mkdir jcef_build && cd jcef_build

# Linux: Generate 64-bit Unix Makefiles.
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
# Build using Make.
make -j4

# Mac OS X: Generate 64-bit Xcode project files.
cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
# Open jcef.xcodeproj in Xcode
# - Select Scheme > Edit Scheme and change the "Build Configuration" to "Release"
# - Select Product > Build.

# Windows: Generate 64-bit VS2015 project files.
cmake -G "Visual Studio 14 Win64" ..
# 32 bit
# cmake -G "Visual Studio 14" ..
# Open jcef.sln in Visual Studio
# - Select Build > Configuration Manager and change the "Active solution configuration" to "Release"
# - Select Build > Build Solution.

若这个步骤出现JDK依赖错误,通常是使用64 bit 的机器上使用32 bit的JDK,make的时候,看最后的输出,

-- Java directory:               C:/jdk1.8.0_121_x86
-- JNI libraries: C:/jdk1.8.0_121_x86/lib/jawt.lib;C:/jdk1.8.0_121_x86/lib/jvm.lib
-- JNI include directories: C:/jdk1.8.0_121_x86/include;C:/jdk1.8.0_121_x86/include/win32;C:/jdk1.8.0_121_x86/include
-- Configuring done
-- Generating done

上面的输出可以看到,Java directory和JNI libraries 选择了32位的JDK的路径,重新安装JDK和配置了64 bit JDK到环境变量中,删除jcef build 中的所有文件,重新执行make 步骤即可。

执行完成后输入如下:

-- Configuring done
-- Generating done
-- Build files have been written to: D:/learn/jecf/src/jcef_build

编译cef 依赖的dll

由于JCEF是java对CEF的封装,因此还是需要依赖CEF的,CEF及相关的bridge编译使用VS来完成的。
进入jcef_build目录,打开jcef.sln
将解决方案的项目配置由 debug 改成release ,然后直接生成,生产成功后,输出如下:

5>------ 已跳过生成: 项目: ALL_BUILD, 配置: Debug x64 ------
5>没有为此解决方案配置选中要生成的项目
========== 生成: 成功 4 个,失败 0 个,最新 0 个,跳过 1 个 ==========

编译java 代码

执行compile.bat win64
32 bit 执行 compile.bat win32

D:\learn\jecf\src\tools>compile.bat win64
D:\learn\jecf\src\java\tests\detailed\handler\binding_test.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\binding_test.html
D:\learn\jecf\src\java\tests\detailed\handler\binding_test2.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\binding_test2.html
D:\learn\jecf\src\java\tests\detailed\handler\localstorage.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\localstorage.html
D:\learn\jecf\src\java\tests\detailed\handler\spellcheck.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\spellcheck.html
D:\learn\jecf\src\java\tests\detailed\handler\transparency.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\transparency.html
复制了 5 个文件
D:\learn\jecf\src\java\tests\detailed\handler\logo.png -> D:\learn\jecf\src\out\win64\tests\detailed\handler\logo.png
复制了 1 个文件

D:\learn\jecf\src\tools>run.bat win64 Release detailed
ERROR: Native build output path does not exist

D:\learn\jecf\src\tools>

编译后的测试

执行run.bat win64 Release detailed
32 bit 执行 run.bat win32 Release detailed
得到一个嵌入了浏览器的AWT界面的java应用,在地址栏输入https://html5test.com/,可以看到得到的分数基本与安装的Chrome一致

若VS没有修改项目配置为release,执行时候报Release 路径没有找到

编译后分发

执行 make_distrib.bat win64
32 bit 执行 make_distrib.bat win32

D:\learn\jecf\src\tools>make_distrib.bat win64
ERROR: Native Release build output path does not exist

若VS没有修改项目配置为release,同样执行时候报Release 路径没有找到

分发后测试

若执行成功,在src目录下会增加一个binary_distrib的文件夹,里面就是打包好的分发的文件了。

进入binary_distrib执行run.bat,运行得到与编译后的测试一致的应用;

至此,编译jcef的过程结束

Windows下编译jcef的更多相关文章

  1. [转] Windows下编译OpenSSL

    简述 OpenSSL是一个开源的第三方库,它实现了SSL(Secure SocketLayer)和TLS(Transport Layer Security)协议,被广泛企业应用所采用.对于一般的开发人 ...

  2. Windows下编译objective-C

    Windows下编译objective-C 2011-08-31 14:32 630人阅读 评论(0) 收藏 举报 windowscocoa工具objective clibraryxcode   目录 ...

  3. 在Windows下编译FFmpeg详细说明

    MinGW:一个可自由使用和自由发布的Windows特定头文件和使用GNC工具集导入库的集合,允许你生成本地的Windows程序而不需要第三方C运行时 MinGW,即 Minimalist GNU F ...

  4. 如何在WINDOWS下编译BOOST C++库 .

    如何在WINDOWS下编译BOOST C++库 cheungmine 2008-6-25   写出来,怕自己以后忘记了,也为初学者参考.使用VC8.0和boost1.35.0.   1)下载boost ...

  5. 在Windows下编译OpenSSL(VS2005和VC6)

    需要说明的是请一定安装openssl-0.9.8a .  openssl-1.0.0我没有编译成功. 如何在Windows下编译OpenSSL (Vs2005使用Vc8的cl编译器)1.安装Activ ...

  6. windows下编译java源文件的编码错误

    import java.util.Arrays;public class ArrayAsAReference{ public static void main(String[] args) { int ...

  7. Windows下编译SDL

    Windows下编译SDL的理由我就不多说了,无论用VS来编译或调试SDL库都是很方便的.而且SDL源代码中也包含了VC工程,你所要做的只是解压VC工程,进行适当的配置,然后编译.调试. 编译SDL大 ...

  8. Windows下编译安装 FFmpeg

    在Linux/Mac下编译 ffmpeg是非常方便的.但要在 Windows下编译 ffmpeg还真要花点时间.以下就是在 Windowns下编译ffmpeg的步骤: 一.安装Cygwin 在wind ...

  9. windows下编译php7图形库php_ui.dll

    CSDN博客 具有图形化编程才有意思,这几天看到了php ui 图形扩展,只是现在只能下载php 7.1的 本次教程编译php7.2.6的 php ui 要是linux下编译起来比较简单 但是 win ...

随机推荐

  1. 软件测试自动化…python学习到什么程度?代码好不好学!

    软件测试自动化…python学习到什么程度?代码好不好学! 如下:

  2. python中的operator.itemgetter函数

    operator.itemgetter函数operator模块提供的itemgetter函数用于获取对象的哪些维的数据,参数为一些序号.看下面的例子 a = [,,] >>> b=) ...

  3. VS2017 性能优化方法

    原文地址:https://www.cnblogs.com/mahatmasmile/p/10394168.html 出处1:https://docs.microsoft.com/zh-cn/visua ...

  4. netstat、ps、top 、kill 命令备忘

    1.ps命令用于显示当前进程 (process) 的状态. -aux 显示所有包含其他使用者的行程. -e 显示所有进程. -f 全格式输出. 一般带参数 -ef 或者 -aux ,差别不大. 区别: ...

  5. SQL语句50题

    -- 一.创建教学系统的数据库,表,以及数据 --student(sno,sname,sage,ssex) 学生表--course(cno,cname,tno) 课程表--sc(sno,cno,sco ...

  6. 出错: IOException parsing XML document from ServletContext resource [/cn.mgy.conig]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/cn.mgy.conig]

    错误的详细内容: 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanDefinitionStoreExceptio ...

  7. iOS开发之GCD同步主线程、异步主线程

    /** 在主线程执行block */ + (void)gs_synExecuteOnMainThread:(void (^)(void))block { if ((nil == block) || ( ...

  8. Qt之excel 操作使用说明

    学习背景: 适合熟悉些qt开发,但是不是深入了解的开发者学习.具体实现(qt 5.1版本),office2007 Excel做验证,Win 7(64位),如有讲解有误,欢迎斧正! 一.简单介绍 QAx ...

  9. 关于8.0.15版本的mysql下载与安装

    下载MYSQL 官网下载MYSQL8.0.15版本,链接地址https://www.mysql.com/downloads/,流程如下 点击进入后,网页滑到最下面,根据自己电脑的型号下载相应的版本 安 ...

  10. oracle数据库学习

    trunc(number[,decimals])--number 待做截取处理的数值:decimals 指明需保留小数点后面的位数     CREATE PUBLIC DATABASE LINK Co ...