20

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

After lots of search i found Chromium Embedded Framework (CEF) or JCEF Java 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?

Is it possible to embed CEF/JCEF in java application?

Mrinal
  • 326
  • 1
  • 4
  • 10
Amogh
  • 4,220
  • 9
  • 36
  • 91
  • Your best chance for getting an answer is on the [CEF Support Forum](http://www.magpcss.org/ceforum/viewforum.php?f=6). Recently, Marshall the founder of CEF, took over the JCEF project. So feel free to ask questions on the CEF Forum. Post a link to the topic after you ask there. – Czarek Tomczak Jan 18 '14 at 11:16
  • 5
    @CzarekTomczak that forum is horrendous. Why is there no quickstart for this? It just gives you a download page, and tells you nothing about how to get the binaries working. – thouliha Jun 11 '15 at 18:23
  • 1
    @thouliha See the Quick Links section and the Tutorial wiki page here: https://bitbucket.org/chromiumembedded/cef . See also other wiki pages: https://bitbucket.org/chromiumembedded/cef/wiki/browse/ – Czarek Tomczak Jun 11 '15 at 18:38
  • is it still having a lot of bugs? I saw the bitbucket.org comments over there.... – gumuruh Jan 26 '17 at 07:30

2 Answers2

18

Is it possible to embed CEF/JCEF in java application?

Yes, you can do that! The steps are:

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

For example: mvn install:install-file -Dfile=gluegen-rt.jar -DgroupId=org.jcef -DartifactId=gluegen -Dversion=1.0 -Dpackaging=jar

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

  2. Copy sample: ${EXTRACT_DIR}/bin/tests/simple/MainFrame.java to your project and try it

Take note that those steps are for Maven Project and JVM 64bit

Tho
  • 17,326
  • 6
  • 51
  • 41
  • I am also working on the same JCEF as I posted in answer. I will surprise if there is any 32bit version. – Amogh Jul 26 '14 at 14:32
  • 2
    No, JCEF also supports JVM 32 bit but it may not be tested carefully https://code.google.com/p/javachromiumembedded/wiki/BranchesAndBuilding – Tho Jul 26 '14 at 15:37
  • Hi, I m trying to set up/build JCEF in eclipse. Please share steps to do so? You can post answer here http://stackoverflow.com/questions/25761607/setting-up-cef-development-in-eclipse-for-java –  Sep 10 '14 at 14:56
  • I'm trying to get it working for linux, which files do i use? – thouliha Jun 11 '15 at 18:27
  • In step 2, "Declare Environment Variable", can you explain in more detail? What environment variable are we declaring? – Vigs Dec 20 '15 at 02:34
  • Please check out this link https://en.m.wikipedia.org/wiki/Environment_variable . You could simple append the path to PATH variable – Tho Dec 20 '15 at 04:36
  • Thanks. Sorry I should have been more specific. I understand what a environment variable does and how to use them. But in this specific case I do not understand why we are adding the the ${extract_dir} to our path? Furthermore, your instructions seem to be a it unclear as the download on the link your provided don't seem to include JCEF. I had to follow instructions [here](https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding) to build JCEF. – Vigs Dec 20 '15 at 15:20
  • 3
    I understand why we need the native code added to the path now. For others who stumble on this: In `CefApp.java`, jcef tries to load the libcef and jawt libraries, which exist in the output dir of the native cef build. We must make those libs discoverable by adding that directory to the systems path. – Vigs Dec 20 '15 at 17:38
15

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

https://github.com/jcefbuild/jcefbuild/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.

The zips also contain a test application which can be executed by running a script also found in the folder.

smac89
  • 26,360
  • 11
  • 91
  • 124
  • @toolforger why do you say that? – smac89 Jun 11 '20 at 13:29
  • Ah... wait... I confused this with Maven Central availability. Sorry. – toolforger Jun 11 '20 at 14:07
  • 2
    I wrote a very brief article on how to get started with the releases mentioned above http://whereisdarran.com/2020/12/getting-started-with-java-cef-on-linux/ – dazza5000 Dec 05 '20 at 21:28
  • @dazza5000 that's great. Short and sweet. I haven't had time to create maven jars for full Java development, but I will make sure to ping your comment when that's ready – smac89 Dec 05 '20 at 21:46