xiruibing / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

Linux/Mac: Fix discovery of icudtl.dat #109

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Congrats on the work for revision 99 with the adoption of CEF 3.1916.1749 and 
the Mac fix for visibility. For the first time we can have multiple tabs 
working on the Mac :-) I did notice a regression affecting those that launch 
their app through the java command line. Details below.

What steps will reproduce the problem?
1. Get and build latest JCEF r99 on Mac
2. Double click on jcef_app.app. All works fine.
3. Start a Java program that uses jcef, from the command line (using e.g. 
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin/java) 

What is the expected output? What do you see instead?

When starting the program from the command line with the java executable, 
Java_org_cef_CefApp_N_1Initialize fails with the following msg.

[0815/140948:FATAL:content_main_runner.cc(751)] Check failed: 
base::i18n::InitializeICU(). 

A bad workaround is to copy icudtl.dat from 
jcef_app.app/Contents/Frameworks/Resources/ to 
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin/java (or 
wherever your java executable is installed).

What do you recommend to have util_mac::CefInitializeOnMainThread find 
icudtl.dat in the right location instead of getting it from the main 
executable's path? pathToJavaDLL points to jcef_app.app/Contents/Java, we can 
build the full path pointing to jcef_app.app/Contents/Frameworks/Resources/. 
How can we tell CEF to use that location?

These 2 links are interesting.
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11459https://code.google.com/
p/chromiumembedded/issues/detail?id=1198

This was not a pb with former revisions (r90) when icudtl.dll was loaded as a 
dll directly.

Original issue reported on code.google.com by christop...@gmail.com on 15 Aug 2014 at 6:35

GoogleCodeExporter commented 9 years ago
Looking at InitializeICU in icu_util.cc
https://chromium.googlesource.com/chromium/src/base/+/refs/heads/master/i18n/icu
_util.cc

The code uses the module_dir on Windows only. On Mac, it uses different logic. 
And this doesn't seem to be controllable by a property.

Original comment by christop...@gmail.com on 18 Aug 2014 at 2:11

GoogleCodeExporter commented 9 years ago
Issue 110 has been merged into this issue.

Original comment by magreenb...@gmail.com on 20 Aug 2014 at 3:10

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 20 Aug 2014 at 3:11

GoogleCodeExporter commented 9 years ago
Hi, 
   How are you launching the app using Java at command line. I am not much familiar with MAC env. I have it working in Linux. But on MAC I am not able to get the app to come up using "Java" at command line. The "JCEF_app" does work. 

Original comment by anth...@gmail.com on 29 Aug 2014 at 4:38

GoogleCodeExporter commented 9 years ago
Anth: I'm away from the mac I use for the next few days so i can't paste you 
the exact command line until then. It's pretty similar to Linux except the 
native libs and jars are in different folders. Yes the "JCEF_app" works, the pb 
is for those running without their own custom bundled app such as 
java/javaw/javaws. Maybe someone else will reply to you before I get back to 
you...

Original comment by christop...@gmail.com on 29 Aug 2014 at 11:01

GoogleCodeExporter commented 9 years ago
Hi Christopher,
    That's not an issue. Please post it when you get a chance. I tried various options. Since the xcode also tries to hardcode the path to different libraries it becomes a bit contrived to get the command line working. I tried to change the PATH references of the built libraries to make it simpler also. I still couldn't get it to work.

Original comment by anth...@gmail.com on 31 Aug 2014 at 6:33

GoogleCodeExporter commented 9 years ago
Hi Christopher,
    If you have access to your MAC, can you please post the command line?

Original comment by anth...@gmail.com on 8 Sep 2014 at 12:53

GoogleCodeExporter commented 9 years ago
Hi Anth: here it is. It's very similar to the command line on Windows (run.bat).

Open console
Go to directory that contains jcef_app.app (e.g. 
<...>/jcef/src/xcodebuild/Release/
java -cp "./jcef_app.app/Contents/Java/*" 
-Djava.library.path=./jcef_app.app/Contents/Java tests.detailed.MainFrame

This works fine with revision92. With revision99, this fails with the following 
output:

java -cp "./jcef_app.app/Contents/Java/*" 
-Djava.library.path=./jcef_app.app/Contents/Java tests.detailed.MainFrame
Offscreen rendering disabled
Using:
JCEF Version = 3.1916.1749.99
CEF Version = 3.1916.1749
Chromium Version = 35.0.1916.138
initialize on Thread[AWT-EventQueue-0,6,main] with library path 
./jcef_app.app/Contents/Java
Added scheme search://
Added scheme client://
[0909/090956:FATAL:content_main_runner.cc(751)] Check failed: 
base::i18n::InitializeICU(). 
Trace/BPT trap: 5

Original comment by christop...@gmail.com on 9 Sep 2014 at 1:11

GoogleCodeExporter commented 9 years ago
Thanks. That works. 

Original comment by anth...@gmail.com on 9 Sep 2014 at 2:58

GoogleCodeExporter commented 9 years ago
> Thanks. That works. 
Hi Anth... I'm suspended on your last words... Were you working on a Chromium 
patch to make the loading of icudtl.dat more flexible?

Original comment by christop...@gmail.com on 23 Sep 2014 at 3:20

GoogleCodeExporter commented 9 years ago
No. I was not able to get the MAC command line working. Your suggestion helped. 
I was trying to change the library paths using install_name_tool to change the 
directory structure to launch the app, as I wanted to customize the structure. 
But I couldn't get the Java command line working correctly. 

I had the same problem in Linux and your issue report helped to work around 
that issue there.

Your suggestion helped getting it working on MAC. 

Also, icudtl.dat may be part of the CEF issue. There were some people 
complaining about it had to be in the directory where the binary 
(CEFClient.exe) is located.

I have not found alternative yet.

Original comment by anth...@gmail.com on 23 Sep 2014 at 4:17

GoogleCodeExporter commented 9 years ago
I'm afraid there's no alternative but to modify the code in 
https://chromium.googlesource.com/chromium/src/base/+/refs/heads/master/i18n/icu
_util.cc . Unfortunately it's not in JCEF or CEF, it's in Chromium.

Original comment by christop...@gmail.com on 23 Sep 2014 at 4:45

GoogleCodeExporter commented 9 years ago
JCEF is transitioning from Google Code to Bitbucket project hosting. If you 
would like to continue receiving notifications on this issue please add 
yourself as a Watcher at the new location: 
https://bitbucket.org/chromiumembedded/java-cef/issue/109

Original comment by magreenb...@gmail.com on 18 Mar 2015 at 6:00