Wiki

Clone wiki

java-cef / BranchesAndBuilding

This Wiki page lists notes for JCEF releases.

Note to Editors: Changes made to this Wiki page without prior approval via the JCEF Forum or Issue Tracker may be lost or reverted.



Background

The JCEF project is an extension of the Chromium Embedded Framework project hosted at https://bitbucket.org/chromiumembedded/cef/. JCEF maintains a development branch that tracks the most recent CEF release branch. JCEF source code (both native code and Java code) can be built manually as described below.

Development

Ongoing development of JCEF occurs on the master branch. This location tracks the current CEF3 release branch.

Building from Source Code

Building JCEF from source code is currently supported on Windows, Linux and Mac OS X for 64-bit Oracle Java targets. 32-bit builds are also possible on Windows and Linux but they are untested.

To build JCEF from source code you should begin by installing the build prerequisites for your operating system and development environment. For all platforms this includes:

For Linux platforms:

  • Currently supported distributions include Debian 10 (Buster), Ubuntu 18 (Bionic Beaver), and related. Ubuntu 18.04 64-bit with GCC 7.5.0+ is recommended. Newer versions will likely also work but may not have been tested. Required packages include: build-essential, libgtk-3-dev.

For Mac OS X platforms:

  • Apache Ant is required to build the Java app bundle.
  • Java version newer than 8u121 is required.
  • Xcode 12.2 to 13.0 building on MacOS 10.15.4 (Catalina) or newer. The Xcode command-line tools must also be installed. Only 64-bit builds are supported on macOS.

For Windows platforms:

  • Visual Studio 2019 or newer building on Windows 7 or newer. Windows 10 64-bit are recommended.

Building with Docker or GitHub Actions

For a quick and easy build setup, you can run your builds on Docker (Linux/Windows) or use GitHub Actions (with Docker). The jcefbuild repository on GitHub can be forked and used to compile your own custom sources, providing one-line build scripts for each platform, Docker environments for Linux and Windows, as well as GitHub Actions workflows for all platforms. It also adds support for more build architectures (arm64 + arm/v6 on Linux, arm64 on Windows). For more information, visit the repository readme file.

Building Manually

Building can also be performed as a series of manual steps.

Downloading Source Code

Download JCEF source code using Git.

# The JCEF source code will exist at `/path/to/java-cef/src`
cd /path/to/java-cef
git clone https://bitbucket.org/chromiumembedded/java-cef.git src

Building

1. Run CMake to generate platform-specific project files and then build the resulting native targets. See CMake output for any additional steps that may be necessary. For example, to generate a Release build of the jcef and jcef_helper targets:

# 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 VS2019 project files.
cmake -G "Visual Studio 16" -A x64 ..
# Open jcef.sln in Visual Studio
# - Select Build > Configuration Manager and change the "Active solution configuration" to "Release"
# - Select Build > Build Solution.

JCEF supports a number of different project formats via CMake including Ninja. See comments in the top-level CMakeLists.txt file for additional CMake usage instructions.

2. On Windows and Linux build the JCEF Java classes using the compile.[bat|sh] tool.

cd /path/to/java-cef/src/tools
compile.bat win64

On Mac OS X the JCEF Java classes are already built by the CMake project.

3. On Windows and Linux test that the resulting build works using the run.[bat|sh] tool. You can either run the simple example (see java/simple/MainFrame.java) or the detailed one (see java/detailed/MainFrame.java) by appending "detailed" or "simple" to the run.[bat|sh] tool. This example assumes that the "Release" configuration was built in step 1 and that you want to use the detailed example.

cd /path/to/java-cef/src/tools
run.bat win64 Release detailed

On Mac OS X run jcef_app for the detailed example. Either use the command-line or double-click on jcef_app in Finder.

cd /path/to/java-cef/src/jcef_build/native/Release
open jcef_app.app

Packaging

After building the Release configurations you can use the make_distrib.[bat|sh] script to create a binary distribution.

cd /path/to/java-cef/src/tools
make_distrib.bat win64

If the process succeeds a binary distribution package will be created in the /path/to/java-cef/src/binary_distrib directory. See the README.txt file in that directory for usage instructions.

Updated