简体   繁体   中英

can't use create CEF browser from codename one

My app is failing to run the BrowserComponent everytime I try to call it inside codename one. It gives me an error of failure to create CEF browser. Everything beside that is running just fine. I uninstalled and installed CEF as instructed in this link Codename One CEF Support I tried to fix my problem as I found it inside Known Issues from the previous link

I did as instructed and tried to fix the LD_LIBRARY_PATH

here is the output of my terminal after I did so:

[kagha@archbios ~]$ whereis java
java: /usr/bin/java /usr/share/java /usr/lib/jvm/java-8-jdk/bin/java
[kagha@archbios ~]$ echo $JAVA_HOME
/usr/lib/jvm/java-8-jdk
[kagha@archbios ~]$ echo  $LD_LIBRARY_PATH
/usr/lib/jvm/java-8-jdk/lib/amd64
[kagha@archbios ~]$ find /usr/lib/jvm/java-8-jdk/ | grep "libawt.so"
/usr/lib/jvm/java-8-jdk/jre/lib/amd64/libawt.so

but the problem is still there I am using the OS Arch Linux with Kernel version 5.10.32-1-lts and Apache netbeans 12.1 as an IDE

The code I am trying to run

Form hi = new Form("Browser", new BorderLayout());
BrowserComponent browser = new BrowserComponent();
browser.setURL("https://www.codenameone.com/");
hi.add(BorderLayout.CENTER, browser);*/

Here is the full error in the console:

[EDT] 0:0:0,282 - Attempting to create browser component
[AWT-EventQueue-0] 0:0:0,284 - Attempting to create browser component
java.lang.UnsatisfiedLinkError: /home/kagha/.codenameone/cef/lib/linux64/libjcef.so: libjawt.so: cannot open shared object file: No such file or directory
[EDT] 0:0:0,326 - Exception: java.lang.UnsatisfiedLinkError - /home/kagha/.codenameone/cef/lib/linux64/libjcef.so: libjawt.so: cannot open shared object file: No such file or directory
[EDT] 0:0:0,327 - Exception: java.lang.RuntimeException - Failed to create CEF browser
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1830)
    at java.lang.Runtime.loadLibrary0(Runtime.java:871)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.cef.SystemBootstrap$1.loadLibrary(SystemBootstrap.java:24)
    at org.cef.SystemBootstrap.loadLibrary(SystemBootstrap.java:36)
    at org.cef.CefApp.startup(CefApp.java:536)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:207)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:199)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:196)
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createCEFBrowserComponent(JavaCEFSEPort.java:139)
    at com.codename1.impl.javase.cef.JavaCEFSEPort$2.run(JavaCEFSEPort.java:121)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java.lang.RuntimeException: Failed to create CEF browser
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createCEFBrowserComponent(JavaCEFSEPort.java:133)
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createBrowserComponent(JavaCEFSEPort.java:98)
    at com.codename1.ui.BrowserComponent$9.run(BrowserComponent.java:557)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1338)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:1280)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:1162)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.UnsatisfiedLinkError: /home/kagha/.codenameone/cef/lib/linux64/libjcef.so: libjawt.so: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1830)
    at java.lang.Runtime.loadLibrary0(Runtime.java:871)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.cef.SystemBootstrap$1.loadLibrary(SystemBootstrap.java:24)
    at org.cef.SystemBootstrap.loadLibrary(SystemBootstrap.java:36)
    at org.cef.CefApp.startup(CefApp.java:536)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:207)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:199)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:196)
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createCEFBrowserComponent(JavaCEFSEPort.java:139)
    at com.codename1.impl.javase.cef.JavaCEFSEPort$2.run(JavaCEFSEPort.java:121)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
BUILD SUCCESSFUL (total time: 8 seconds)

I will appreciate any help and provide more information if needed, thanks in advance

You should use the new Maven support . This should fix issue as the Maven plugin will automatically add the needed entries to the LD_LIBRARY_PATH .

You can download a base template from https://start.codenameone.com and just paste your code there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM