GithubHelp home page GithubHelp logo

jetbrains / jcef Goto Github PK

View Code? Open in Web Editor NEW
234.0 31.0 38.0 47.68 MB

A simple framework for embedding Chromium-based browsers into Java-based applications.

License: Other

CMake 1.97% Java 45.86% HTML 0.29% C++ 35.99% C 0.07% Objective-C 0.15% Objective-C++ 1.13% Python 11.29% Batchfile 0.95% Shell 1.51% Dockerfile 0.10% Thrift 0.70%

jcef's Introduction

official JetBrains project

Welcome

This is a fork of java-cef. It's distributed as part of JetBrainsRuntime.

Quick Links

Help

  • Check the issue tracker. Probably the problem is known.
  • Vote the for the opened issues. We track votes and take it into consideration for planning.
  • JetBrains Platform Slack community
  • Check CEF forum. It is a great source of knowledge about cef project.
  • Report a bug at JetBrains youtrack.

Building JCEF

Building on Windows

  1. Get sources.
    git clone https://github.com/JetBrains/jcef.git
    
  2. Install Apache Ant. Make sure that ANT_HOME is set.
  3. Set JAVA_HOME.
  4. Set VS160COMNTOOLS env variable to point onto your Visual Studio 2019 Community installation. E.g.
    VS160COMNTOOLS='C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools'.
    
  5. Install cmake. Set JCEF_CMAKE env variable. E.g.
    `JCEF_CMAKE='C:\cmake-3.27.0-rc2-windows-x86_64'`.
    
  6. Run at <project_root>\jb\tools\windows directory. Replace x86_64 with arm64 if needed.
    cmd /c build.bat all x86_64
    
  7. Check jcef_win_x86_64.tar.gz or jcef_win_arm64.tar.gz file in the project root directory.

Building JetBrainsRuntime with JCEF.

  1. Assume that we are working on x86_64 platform. For x64 or x86_64 has to replaced with arm64 or aarch64.

  2. Prepare the build environment for JetBrainsRuntime(JBR). Next command are run under Cygwin bash installed on this step.

    Note: You may skip NVDA controller client installation, but you'd need to patch mkimages_x64.sh script.

  3. Get JBR sources

    $ git clone https://github.com/JetBrains/JetBrainsRuntime.git
    $ cd JetBrainsRuntime
  4. Switch to the required branch. E.g.

    $ git checkout jbr17
  5. Bring jcef build artifact from the previous steps. Assuming that our platform is x86_64.

    $ mkdir jcef_win_x64
    $ tar -xvzf <jcef_project_root>/jcef_win_x86_64.tar.gz -C ./jcef_win_x64
  6. (Optional). If NVDA Controller Client is not installed, patch mkimages_x64.sh. Remove the following line:

        --with-nvdacontrollerclient=$NVDA_PATH \
    
  7. Set BOOT_JDK env var.

  8. Run:

       $ bash jb/project/tools/windows/scripts/mkimages_x64.sh 1 jcef

    1 - is the build number.

  9. Check output dirs:

    $ ls jbr*
    jbr_jcef-17.0.8.1-windows-x64-b1:
    bin  conf  include  legal  lib  release
    
    jbrsdk_jcef-17.0.8.1-windows-x64-b1:
    bin  conf  include  jmods  legal  lib  release

Building on Linux

  1. Get tools to build jcef apt-get install ant git gcc cmake.
  2. Get tools to build jcef rpc apt-get install bison flex pkg-config.
  3. Get sources
    git clone https://github.com/JetBrains/jcef.git
  4. Set JAVA_HOME.
  5. Run ./jb/tools/linux/build.sh all <x86_64 or arm64> at the project root.
  6. Check jcef_linux_<x86_64 or arm64>.tar.gz file in the project root directory.

Building on Mac

  1. Get sources git clone https://github.com/JetBrains/jcef.git
  2. Set JAVA_HOME.
  3. Run ./jb/tools/mac/build.sh all <x86_64 or arm64> at the project root.
  4. Check jcef_mac_<x86_64 or arm64>.tar.gz file in the project root directory.

Developing with CLion

To be done

Developing with IntelliJ IDEA and running the tests

  1. Open <project_root>/jb/project/java-gradle/build.gradle as project in IntelliJ IDEA.
  2. Edit <project_root>/jb/project/java-gradle/gradle.properties to specify path to the tested JBR+JCEF build. E.g.
    jbr_win = <path to jbr>/jbr_jcef-17.0.8.1-windows-x64-b1
    jbr_mac = <path to jbr>/jbrsdk_jcef-17.0.8.1-osx-aarch64-b1/Contents/Home
    jbr_linux = <path to jbr>/jbr
    
  3. Reload the gradle project.
  4. Navigate a test in <project_root>/java_tests/tests/junittests and run.

Out of process CEF

See remote/README.md.

jcef's People

Contributors

1fxe avatar apique13 avatar artemm-bochkarev avatar dcernoch-up avatar esayapina avatar fg185036 avatar forantar avatar frankdekker avatar friwidev avatar guusdk avatar harmfulbreeze avatar hugoboffin avatar jjlauer avatar joejensen avatar leesnhyun avatar magreenblatt avatar maxsenft avatar millosr avatar nikitkocent avatar osiris-team avatar s1artie avatar shalupov avatar smac89 avatar soscomp avatar throwable-one avatar ujpv avatar vladrassokhin avatar yaaz avatar yazgoo avatar yuanuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jcef's Issues

can't invoke native method 'updateUI' before native context initialized

Describe the bug
Unable to start browser

Screenshots
image

Version and environment:

  • OS: macOS 14.5
  • JetBrains Runtime version: jbr_fd-21.0.3-osx-aarch64-b509.4
  • CPU: Apple M3 Pro
  • JCEF Version: I can't get
  • CEF Version: I can't get
  • Is OSR enabled: No

Additional context
Code:

import org.cef.CefApp;
import org.cef.CefClient;
import org.cef.CefSettings;
import org.cef.browser.CefBrowser;
import org.cef.browser.CefRendering;

import javax.swing.*;

public class Demo {
    public static void main(String[] args) {
        final CefSettings cefSettings = new CefSettings();
        cefSettings.windowless_rendering_enabled = false;

        final CefApp cefApp = CefApp.getInstance(cefSettings);
        System.out.println(cefApp.getVersion());

        final CefClient cefClient = cefApp.createClient();
        final CefBrowser browser = cefClient.createBrowser("https://www.baidu.com", CefRendering.DEFAULT, true);

        final JFrame frame = new JFrame();
        frame.setTitle("Test");
        frame.add(browser.getUIComponent());
        frame.setSize(500, 500);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

Logs:

JCEF(20:36:787): initialized stderr logger, severity=LOGSEVERITY_DEFAULT
JCEF_I(20:36:794): CefApp: set state NEW
JCEF_E(20:36:984): Failed to get CEF version. 'org.cef.CefApp$CefVersion org.cef.CefApp.N_GetVersion()'
null
JCEF_E(20:37:179): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_E(20:37:179): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_E(20:37:179): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'notifyMoveOrResizeStarted' before native context initialized
2024-07-25 23:20:37.213 java[149:12030038] === getJavaWindowTabbingMode: 0 ===
JCEF_E(20:37:310): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'setParent' before native context initialized
JCEF_E(20:37:313): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_E(20:37:314): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_E(20:37:314): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'wasResized' before native context initialized
JCEF_E(20:37:315): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_E(20:37:316): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'notifyMoveOrResizeStarted' before native context initialized
JCEF_E(20:37:316): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
2024-07-25 23:20:37.330 java[149:12030038] became key: 0 Test (null)
2024-07-25 23:20:37.330 java[149:12030038] became main: 1 Test (null)
JCEF_E(20:37:351): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'setWindowVisibility' before native context initialized
JCEF_E(20:37:352): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_E(20:37:368): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'setFocus' before native context initialized
JCEF_E(20:37:368): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_E(20:37:368): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'notifyMoveOrResizeStarted' before native context initialized
JCEF_E(20:37:376): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'updateUI' before native context initialized
JCEF_V(20:37:482): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: add delayed action createBrowser
2024-07-25 23:20:39.386 java[149:12030038] resigned main: 1 Test (null)
2024-07-25 23:20:39.386 java[149:12030038] resigned key: 0 Test (null)
2024-07-25 23:20:39.386 java[149:12030038] deactivating window: Test
JCEF_E(20:39:389): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'setWindowVisibility' before native context initialized
JCEF_E(20:39:390): CefBrowser_N: org.cef.browser.CefBrowserWr@2133814f: can't invoke native method 'setFocus' before native context initialized

Java used fileDialog for swing

Error Info:
java.lang.UnsatisfiedLinkError: org.cef.callback.CefFileDialogCallback_N.N_Continue(JLjava/util/Vector;)V

I have tested all versions with this issue and have learned that only this method cannot be used
Addition:
N_Cancel method is Normal

Running Backend And FrontEnd through Intellij Plugin

We are creating an IntelliJ plugin which uses JCEF web-view to show the UI by reusing the components from our earlier command line tool. Earlier we had created a command line tool where we had our frontend in react and backend in spring boot.

In order to create the plugin we need a way to start both the backend (spring boot) and frontend (React) servers from the plugin itself. Basically when the user clicks the plugin's icon in Intellij it should start both backend and frontend servers. Can anyone please suggest a way/resources to achieve this?

ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

Our System:centOS7.6 aarch64
see the log:

[0325/214524.866040:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
[0325/214525.511311:INFO:render_frame_host_impl.cc(11654)] RenderFrameHostImpl::MaybeGenerateCrashReport url = , status = 3, exit_code = 133
[0325/214526.726842:WARNING:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
[0325/214526.729810:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

build fail on windows 11 x64

Describe the bug
Build failed after running following command: cmd /c build.bat all x86_64

-- Extracting H:/jcef/third_party/cef/cef_binary_119.4.7+g55e15c8+chromium-119.0.6045.199_windows64_minimal.tar.bz2...
-- Using Python: C:/Python38
-- Found JNI: C:/Program Files/Eclipse Adoptium/jdk-17.0.10.7-hotspot/include (Required is at least version "1.7") found components: AWT JVM
-- Generating native/jcef_version.h file...
CMake Error at CMakeLists.txt:283 (message):
  Execution failed with unexpected result: Access is denied


-- Configuring incomplete, errors occurred!
*** BUILD FAILED
*** BUILD FAILED

To Reproduce
Steps to reproduce the behavior:
Clone repo and then run following command in jb\tools\windows
cmd /c build.bat all x86_64

Version and environment:

  • OS: Windows 11
  • CPU: x64
  • JCEF Version: dev branch
  • CEF Version:119 (6045)

Changing Browser Language

Hey,

i tried a few ways to change the Browser Language but its not changing. Thats a snipped out of my code:

    settings = new CefSettings();
    settings.windowless_rendering_enabled = useOSR;
    settings.locale = "de";
    //settings.locale = "de-DE";

    cefApp = CefApp.getInstance(settings);
    CefApp.getInstance(settings);
    client = cefApp.createClient();
    browser = client.createBrowser(startURL, useOSR, isTransparent);

i dont know what is wrong there , i hope there is some help :) , probably im only bit dump and it works easy :D

Thanks guys

Google thinks JCEF is not safe

I have written a plugin through JCEF to render web pages where the web page can be logged in through a Google account. When logging in with my Google account it prompts that the current browser is not secure, how can I avoid this? Where can I get help with this? Any information you can provide would be greatly appreciated.

I am encountering this error when opening a webpage. Google Chrome and Microsoft Edge are both working fine. Please fix this bug officially.

I am encountering this error when opening a webpage. Google Chrome and Microsoft Edge are both working fine. Please fix this bug officially.
Error:
Application error: a client-side exception has occurred (see the browser console for more information).
[0222/184117.656:INFO:CONSOLE(1)] "Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Brel%2C%20href%2C%20precedence%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.",

Access denied when downloading latest CEF binary

$ curl -L https://cache-redirector.jetbrains.com/intellij-jbr/cef_binary_98.3.42%2Bgf00e174%2Bchromium-98.0.4758.102_linux64_minimal.zip
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>7CMVXGS394HTMF8D</RequestId><HostId>lo+JHZpnK4e9fkzE7sgrw912M8lMT5kfeakVfRhI3Gpsezdfnxzqq9m2ZPA2zVoduWLZ/DsfICM=</HostId></Error>

The last version 98.3.34 ( https://cache-redirector.jetbrains.com/intellij-jbr/cef_binary_98.3.34%2Bg97a5ae6%2Bchromium-98.0.4758.102_linux64_minimal.zip. ) can download.

Video Wake Lock on Linux Mint

I am using PyCharm Community with New UI enabled on Linux Mint.

While trying to suspend computer there is warning due to Video Wake Lock on jcef
image
Is it possible to disable this lock?

PS I am not sure whether this is the correct place to report it.

Non-US keyboard layouts don't work properly in macOS in OSR mode

Describe the bug
When a key event is sent to CEF using offscreen rendering, the native code will only bind keys in the standard US layout when in macOS. This is because the code in charge of obtaining the virtual keycode is hardcoded to only work with this layout.

To Reproduce
Steps to reproduce the behavior:

Create a browser in OSR mode.
Type any key that isn't part of the US keyboard layout (e.g. á, ñ`).
You'll see that the key is ignored. This does not occur when OSR is disabled.
Expected behavior
When typing, the key event should be forwarded to CEF.

Screenshots

Versions (please complete the following information):

OS: MacOS 13.0.1
Java Version: OpenJDK 17
JCEF Version: 4a605f4
CEF Version: 110.0.25
Additional context
Does the problem reproduce with the JCEF simple or detailed sample application at the same version?
Yes.

Does the problem reproduce with the CEF cefclient or cefsimple sample application at the same version?
Yes.

Does the problem reproduce with Google Chrome at the same version?
No.

Add any other context about the problem here.
Here's an useful discussion on how to implement layout-independent char->keycode translation:
https://stackoverflow.com/questions/1918841/how-to-convert-ascii-character-to-cgkeycode/1971027#1971027

build failed: module not found

jcef-git (80741ca) build failed

[javac] /tmp/jcef-git/java/module-info.java:4: error: module not found: org.apache.thrift
[javac] requires org.apache.thrift;
[javac] ^
[javac] /tmp/jcef-git/java/module-info.java:5: error: module not found: org.slf4j
[javac] requires org.slf4j;
[javac] ^
[javac] 2 errors

full log:
https://paste.mozilla.org/xfa1pHX1

seems slf4j and thrift module build after build_java.sh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.