How to use JCEF with Maven?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

How to use JCEF with Maven?

Postby clapas » Mon Nov 30, 2015 1:03 pm

Hi,

I have an application which is using JCEF. It works fine except for some rendering issues. I was told the rendering problems are due to the version I was using being too old, so I went to get fresh sources.

I have successfully built and tested the latest sources for JCEF. When I execute the tests with the java command, everything works ok.

But when I try to integrate this custom built version into my main application, which is built using maven2, I get the wellknown base::i18n::InitializeICU() problem.

The icudtl.dat and the other files are there.. I have created the symlinks as explained in the README, otherwise the tests wouldn't work.

I am not very good with maven... Any idea what may be happening? I have only one JVM version on my system, it is the same used by both the java command and maven, i.e. the place where the symlinks were created.

It seems like there is something about Maven that I am missing. Any help will be highly appreciated.

Cheers
clapas
Techie
 
Posts: 18
Joined: Mon Aug 03, 2015 5:10 am

Re: How to use JCEF with Maven?

Postby clapas » Thu Dec 03, 2015 8:31 am

I solved it somehow:

First, in order for Maven to take the java.library.path option you have to set MAVEN_OPTS=-Djava.library.path=/path/to/jcef-libs

E.g. I traced what Maven was executing under the hood for the command

Code: Select all
MAVEN_OPTS=-Djava.library.path="/path/to/jcef_libs" mvn exec:java -Dexec.mainClass="tests.simple.MainFrame" -Djava.library.path="/path/to/jcef_libs"


and it was this:

Code: Select all
/usr/lib/jvm/java-7-oracle/bin/java -Djava.library.path=/path/to/jcef_libs -classpath /usr/share/maven2/boot/classworlds.jar -Dclassworlds.conf=/usr/share/maven2/bin/m2.conf -Dmaven.home=/usr/share/maven2 org.codehaus.classworlds.Launcher "exec:java" "-Dexec.mainClass=tests.simple.MainFrame" "-Djava.library.path=/path/to/jcef_libs"


And I was almost done. but still getting the infamous
Code: Select all
Check failed: base::i18n::InitializeICU()
. I believe the icudtl.dat file was not being found.

I was lucky to try exactly the same command above but using only the command name, e.g. just `java` instead of the absolute path `/usr/lib/jvm/java-7-oracle/bin/java` and, magic, for some reason it works like that. Maybe someone can tell why.

Hope this helps others. Cheers
clapas
Techie
 
Posts: 18
Joined: Mon Aug 03, 2015 5:10 am

Re: How to use JCEF with Maven?

Postby magreenblatt » Thu Dec 03, 2015 10:17 am

clapas wrote:I was lucky to try exactly the same command above but using only the command name, e.g. just `java` instead of the absolute path `/usr/lib/jvm/java-7-oracle/bin/java` and, magic, for some reason it works like that. Maybe someone can tell why.

Maybe you have multiple versions of java installed? Where did you create the icudtl.dat symlink? What does `which java` return?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to use JCEF with Maven?

Postby clapas » Thu Dec 03, 2015 10:20 am

oI have Only one version of java, namely Oracle Java 7.

$ which java
/usr/bin/java

$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 abr 29 2015 /usr/bin/java -> /etc/alternatives/java

$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 39 nov 30 10:30 /etc/alternatives/java -> /usr/lib/jvm/java-7-oracle/jre/bin/java

So finally arrive at the same place.
clapas
Techie
 
Posts: 18
Joined: Mon Aug 03, 2015 5:10 am

Re: How to use JCEF with Maven?

Postby magreenblatt » Thu Dec 03, 2015 10:22 am

Where did you create the icudtl.dat symlink?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to use JCEF with Maven?

Postby clapas » Thu Dec 03, 2015 10:35 am

It is both in /usr/lib/jvm/java-7-oracle/jre/bin and in /path/to/jcef_libs

Removing it from either of them causes an error, i.e. I need to put it in both directories simultaneously.
clapas
Techie
 
Posts: 18
Joined: Mon Aug 03, 2015 5:10 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 60 guests