Updated Tutorial For Eclipse JCEF

Having problems with building or using CEF? This forum is here to help. Please do not post bug reports or feature requests here.

Updated Tutorial For Eclipse JCEF

Postby asevans48 » Tue Apr 12, 2016 5:24 pm

I am trying to run JCEF in Eclipse with Scala for continuity with other programs using network, ETL; etc. My goal is to be able to obtain data over a network that is causing other tools to break while avoiding a memory leak I have been experiencing in Selenium. I was able to get the tool working outside of eclipse. However, before I even get to run the code, a check fails. I tried printing messages in main and my class and they never appear. Is there a way to resolve the following issue with my below listed system specs?

I should also note that I have looked at other posts on this site and Googled, attempting solutions to no avail.

Setup

    IDE: Eclipse Mars
    Jars: Placed in a library known as chromiu. All jars requested by README.txt were added (jogl-all,jogl-all-natives-linux-amd64,jcef,gluegen-rt-natives-linux-amd64,gluegen-rt)
    DLL: Placed in jcef.jar
    JDK: 1.8.0_77
    Scala : 2.11.7


Also all symlink were made as requested by JCEF's Quick Start Guide and the build tool. I checked and there is data in this files.


Sample Code

class Browser(startUrl : String,commandLineArgs :List[String] = null, useOSR : Boolean = OS.isLinux(), isTransparent : Boolean = false,sleepTimeMillis : Long = 10,ignoreCertificateErrors : Boolean = false) extends JFrame{
println("Generating Handlers")
CefApp.addAppHandler(Handlers.getHandlerAdapter)
private var settings = new CefSettings
settings.windowless_rendering_enabled = useOSR
println("Starting App")
private final val cefApp : CefApp = if(commandLineArgs != null && commandLineArgs.size > 0) CefApp.getInstance(ChromeCommandLineParser.parse(commandLineArgs)) else CefApp.getInstance(settings)
private final val client : CefClient = cefApp.createClient()
private final val browser : CefBrowser = client.createBrowser(startUrl,useOSR, isTransparent)
private final val browserUI = browser.getUIComponent
println("Making Visible")
pack()
setSize(800,600)
setVisible(true)
addWindowListener(Handlers.getDefaultWindowListener(this))
......

OTHER CODE HERE
......

}

object Driver{
def main(args : Array[String]):Unit={
println("Starting")
val br = new Browser("https://www.google.com")
println("Quiting")
br.quit()
}
}

I get the same error with MinFrame.java, written by the JCEF folks.

Error

initialize on Thread[AWT-EventQueue-0,6,main] with library path /path/to/jcef/src/binary_distrib/linux64/bin/lib/linux64
[0412/153531:FATAL:content_main_runner.cc(662)] Check failed: base::allocator::IsAllocatorInitialized().
#0 0x7fb1af87262e base::debug::StackTrace::StackTrace()
#1 0x7fb1af88788b logging::LogMessage::~LogMessage()
#2 0x7fb1b2680860 content::ContentMainRunnerImpl::Initialize()
#3 0x7fb1af77f962 CefContext::Initialize()
#4 0x7fb1af77f75b CefInitialize()
#5 0x7fb1af7329b8 cef_initialize
#6 0x7fb1aa22b914 CefInitialize()
#7 0x7fb1aa1e700f Java_org_cef_CefApp_N_1Initialize
#8 0x7fb1fd015994 <unknown>

System

    OS: Ubuntu 16.04 Xenial

    JCEF : Latest from bitbucket

    CEF Binary Branch : 2623 (just under the development branch)

    Java: java 8 oracle at /usr/lib/jvm/java-8-oracle
asevans48
Newbie
 
Posts: 6
Joined: Tue Apr 12, 2016 5:21 pm

Re: Updated Tutorial For Eclipse JCEF

Postby magreenblatt » Wed Apr 13, 2016 2:27 am

You need to run with LD_PRELOAD=/path/to/libcef.so
magreenblatt
Site Admin
 
Posts: 8807
Joined: Fri May 29, 2009 6:57 pm

Re: Updated Tutorial For Eclipse JCEF

Postby asevans48 » Wed Apr 13, 2016 3:23 pm

That worked but now I am getting a different error. Any idea what is wrong?

Code: Select all
[0413/135633:ERROR:icu_util.cc(157)] Invalid file descriptor to ICU data received.
[0413/135633:FATAL:content_main_runner.cc(700)] Check failed: base::i18n::InitializeICU().
#0 0x7ff8fa94a62e base::debug::StackTrace::StackTrace()
#1 0x7ff8fa95f88b logging::LogMessage::~LogMessage()
#2 0x7ff8fd7588d4 content::ContentMainRunnerImpl::Initialize()
#3 0x7ff8fa857962 CefContext::Initialize()
#4 0x7ff8fa85775b CefInitialize()
#5 0x7ff8fa80a9b8 cef_initialize
#6 0x7ff8d6946914 CefInitialize()
#7 0x7ff8d690200f Java_org_cef_CefApp_N_1Initialize
#8 0x7ff8de207994 <unknown>


The closest answer for this I found was with cefSharp which stated to place .pak files in the same directory as the library. I triple checked the links. Everything is in the same directory. However, the check still fails.
asevans48
Newbie
 
Posts: 6
Joined: Tue Apr 12, 2016 5:21 pm

Re: Updated Tutorial For Eclipse JCEF

Postby magreenblatt » Thu Apr 14, 2016 2:40 am

You're missing the icudtl.dat file. To simplify things lets continue the conversation in this thread instead of the other thread.
magreenblatt
Site Admin
 
Posts: 8807
Joined: Fri May 29, 2009 6:57 pm

Re: Updated Tutorial For Eclipse JCEF

Postby asevans48 » Mon Apr 18, 2016 4:42 pm

Ok. I didn't see your above post. However, I am still getting the ICU error. I will post a rather full report below just in case.

I need to use Java 8, specifically the jdk and have jdk 1.8.0.72.

My OS is Ubuntu 16.04 Xenial.

I get the following error but:
Code: Select all
[0418/152415:ERROR:icu_util.cc(157)] Invalid file descriptor to ICU data received.
[0418/152415:FATAL:content_main_runner.cc(700)] Check failed: base::i18n::InitializeICU().
#0 0x7ff5819cc62e base::debug::StackTrace::StackTrace()
#1 0x7ff5819e188b logging::LogMessage::~LogMessage()
#2 0x7ff5847da8d4 content::ContentMainRunnerImpl::Initialize()
#3 0x7ff5818d9962 CefContext::Initialize()
#4 0x7ff5818d975b CefInitialize()
#5 0x7ff58188c9b8 cef_initialize
#6 0x7ff55da6d914 CefInitialize()
#7 0x7ff55da2900f Java_org_cef_CefApp_N_1Initialize
#8 0x7ff565289994 <unknown>



Here is what I did that I though would put icudtl.dat on the path:

Without Maven using a New 64 bit Version of Eclipse due to an Eclipse Update
    1. Remove symlinks
    2. Remove all traces of cef and jcef
    3. Redownload jcef and extract cef binaries of the appropriate version (2623)
    4. Remake Symlinks
    5. Add all jars from the binary_distrib/linux64/bin folder except jcef-tests.jar {gluegen-rt,gluegen-rt-natives,jogl-all,jogl-all-natives,jcef}
    6. Add native library path to binary_distrib with libcef.so, icudtl.dat, snapshot_blob.bin; natives_blob.bin to the jcef.jar library path
    7. Double check the symlinks. They are present.
    8. Setup a new Java Project
    9. Set LD_PRELOAD to the libcef.so file in ~/jcef/src/third_party/native/Release/libcef.so
    10. Attempt to run the project. Fail!
    11. Set LD_PRELOAD to the libcef in the binary_dstrib folder ~/jcef/src/binary_dstrib/linux64/bin/lib/linux64/libcef.so
    12. Try 6-11 with the jcef_build path containing the libraries and finally the cef path without most of them to see what happened (the latter produces an expectedly different error)
    13. Attempt again and fail!

Install With Maven and Try Again

    1. Remove symlinks
    2. Remove all traces of cef and jcef
    3. Redownload jcef and extract cef binaries of the appropriate version (2623)
    4. Remake Symlinks
    5. create an environment variable to the binary_distrib directory and set in path mvn install:install-files -Djarfile=XXXX.jar for gluegen-rt,gluegen-rt-natives,jogl-all,jogl-all-natives;jcef
    6. Setup a new Maven Project
    7. Add all jars to dependency (worked)
    8. Set LD_PRELOAD to the libcef.so file in ~/jcef/src/third_party/native/Release/libcef.so
    9. Attempt to run the project. Fail!
    10. Set LD_PRELOAD to the libcef in the binary_dstrib folder ~/jcef/src/binary_dstrib/linux64/bin/lib/linux64/libcef.so
    11. Try 8-9 with the jcef_build path containing the libraries and finally the cef path without most of them to see what happened (the latter produces an expectedly different error)
    12. Attempt again and fail!

Any idea on how to resolve this? Any help is appreciated.

Thanks
asevans48
Newbie
 
Posts: 6
Joined: Tue Apr 12, 2016 5:21 pm

Re: Updated Tutorial For Eclipse JCEF

Postby magreenblatt » Wed Apr 20, 2016 10:18 am

On Linux it should find icudtl.dat via the symlinks. Try creating the symlinks next to the eclipse executable.
magreenblatt
Site Admin
 
Posts: 8807
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 21 guests