Upcoming JDK version changes

Having problems with building or using the JCEF Java binding? Ask your questions here.

Upcoming JDK version changes

Postby magreenblatt » Thu Sep 27, 2018 9:17 am

Hi All,

JCEF currently targets JDK8 which will exit support in January 2019. At this point we're thinking about moving to JDK11 which released this month (September), and then tracking the JDK version more closely going forward (updating approximately every 6 months with the new JDK release). One nice feature that we should get with newer JDK versions is proper DPI awareness (e.g. detecting high-DPI displays on macOS and Windows).

What do you think about this plan? Are there any issues with newer JDK versions that would block you from using them in your JCEF-based applications?

Thanks,
Marshall
magreenblatt
Site Admin
 
Posts: 9850
Joined: Fri May 29, 2009 6:57 pm

Re: Upcoming JDK version changes

Postby magreenblatt » Mon Oct 08, 2018 6:43 am

magreenblatt
Site Admin
 
Posts: 9850
Joined: Fri May 29, 2009 6:57 pm

Re: Upcoming JDK version changes

Postby Adriaanse » Fri Nov 16, 2018 9:43 am

Eager to upgrade to JDK 11 I have been building and testing JCEF on windows, which works quite well.

Wanting to take this into testing for production I am now trying to build JCEF replacing JDK 8 with JDK 11 on linux.

I am using Ubuntu 14.04 to get a supported version of cmake, which seems to work OK.

However the output of the make -j4 step is instructing me to link the following files, which I cannot find in JDK 11:

/usr/lib/jvm/java-11-oracle/jre/bin/icudtl.dat
/usr/lib/jvm/java-11-oracle/jre/bin/natives_blob.bin
/usr/lib/jvm/java-11-oracle/jre/bin/snapshot_blob.bin

I know a jre folder is no longer included, but these files are not in java-11-oracle/bin either.

I do not know enough about JDK's to fix this myself, so i am hoping to find someone going through the same process here ?
Adriaanse
Newbie
 
Posts: 9
Joined: Fri Nov 16, 2018 9:21 am

Re: Upcoming JDK version changes

Postby magreenblatt » Fri Nov 16, 2018 11:32 am

Adriaanse wrote:However the output of the make -j4 step is instructing me to link the following files, which I cannot find in JDK 11:

/usr/lib/jvm/java-11-oracle/jre/bin/icudtl.dat
/usr/lib/jvm/java-11-oracle/jre/bin/natives_blob.bin
/usr/lib/jvm/java-11-oracle/jre/bin/snapshot_blob.bin

These files come with CEF. Your linking will create the entries at these paths.
magreenblatt
Site Admin
 
Posts: 9850
Joined: Fri May 29, 2009 6:57 pm

Re: Upcoming JDK version changes

Postby Adriaanse » Mon Nov 19, 2018 7:01 am

magreenblatt wrote:These files come with CEF. Your linking will create the entries at these paths.


Sorry i should have noticed that, so as there is no jre folder in JDK 11 I suppose I can link these to /usr/lib/jvm/java-11-oracle/bin/ instead and proceed...

ignoring a few errors that occur when building the javadocs (package com.jogamp.opengl does not exist, package sun.lwawt does not exist) the build seems to be successful so i have some binaries for testing with JDK8 & JDK11 on linux.
Adriaanse
Newbie
 
Posts: 9
Joined: Fri Nov 16, 2018 9:21 am

Re: Upcoming JDK version changes

Postby Adriaanse » Mon Dec 17, 2018 9:12 am

A bit of follow-up information:

The fact that these files were being symlinked to the JDK folders left me wondering why ? ...until i started testing on linux !

We are having problems getting JCEF to work properly on linux (in this case the same ubuntu VM where i compiled JCEF for linux) and searching the support forum and issues list i found this:

https://bitbucket.org/chromiumembedded/ ... -icudtldat

Apparently on linux JCEF will only work if we copy the files icudtl.dat, natives_blob.bin & snapshot_blob.bin to the jre bin folder, and this applies to both JDK8 & JDK11.

So for testing the included sample code using run.sh with JDK11 I need to copy those files to /usr/lib/jvm/java-11-oracle/bin where JDK11 is installed and for our compiled application I need to copy these files to the jre folder we deliver with our application.

Now it is clear to me why these symbolic links in the JDK installation are being created by the build script, it's a work-around for a bug that has been waiting to be fixed in JCEF for 4 years now.
Adriaanse
Newbie
 
Posts: 9
Joined: Fri Nov 16, 2018 9:21 am

Re: Upcoming JDK version changes

Postby kneringerjohann » Thu Feb 21, 2019 11:35 am

I was able to build java-cef with JDK11.

I had to adjust CefBrowserWindowMac.java as follows:

Code: Select all
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.

package org.cef.browser.mac;

import org.cef.browser.CefBrowserWindow;
import sun.awt.AWTAccessor;
import sun.lwawt.LWComponentPeer;
import sun.lwawt.PlatformWindow;
import sun.lwawt.macosx.CFRetainedResource;
import sun.lwawt.macosx.CPlatformWindow;

import java.awt.*;
import java.awt.peer.ComponentPeer;

public class CefBrowserWindowMac implements CefBrowserWindow {
    @Override
    public long getWindowHandle(Component comp) {
        final long[] result = new long[1];
        while (comp != null) {
            if (comp.isLightweight()) {
                comp = comp.getParent();
                continue;
            }
            ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(comp);
            if (peer instanceof LWComponentPeer) {
                @SuppressWarnings("rawtypes")
                PlatformWindow pWindow = ((LWComponentPeer) peer).getPlatformWindow();
                if (pWindow instanceof CPlatformWindow) {
                    ((CPlatformWindow) pWindow).execute(new CFRetainedResource.CFNativeAction() {
                        @Override
                        public void run(long l) {
                            result[0] = l;
                        }
                    });
                    break;
                }
            }
            comp = comp.getParent();
        }
        return result[0];
    }
}


I also had to adjust build.xml with compilerargs as follows:

Code: Select all
  <target name="compile">
    <mkdir dir="${out.path}"/>
    <javac encoding="UTF8" nowarn="on" deprecation="off" debug="on" includeantruntime="false" destdir="${out.path}"
           executable="/usr/bin/javac" fork="true" memoryinitialsize="32m" memorymaximumsize="128m" includeJavaRuntime="yes">
      <compilerarg value="-XDignore.symbol.file"/>
      <compilerarg value="--add-exports"/>
      <compilerarg value="java.desktop/java.awt.peer=ALL-UNNAMED"/>
      <compilerarg value="--add-exports"/>
      <compilerarg value="java.desktop/sun.lwawt=ALL-UNNAMED"/>
      <compilerarg value="--add-exports"/>
      <compilerarg value="java.desktop/sun.lwawt.macosx=ALL-UNNAMED"/>
      <compilerarg value="--add-exports"/>
      <compilerarg value="java.desktop/sun.awt=ALL-UNNAMED"/>
      <classpath location="${jdk7.path}/jre/lib/rt.jar" />
      <classpath refid="class.path"/>
      <src path="java/tests/"/>
      <src path="java/org/cef/"/>
    </javac>
    <copy todir="${out.path}">
      <fileset dir="java" casesensitive="no">
        <exclude name="**/*.java" />
      </fileset>
    </copy>
  </target>


Hope this helps,

regards,
Johann
kneringerjohann
Newbie
 
Posts: 1
Joined: Thu Feb 21, 2019 11:29 am

Re: Upcoming JDK version changes

Postby magreenblatt » Thu Feb 21, 2019 5:18 pm

@Johann Thanks, I've linked to your comment from the issue.
magreenblatt
Site Admin
 
Posts: 9850
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 3 guests