'IntelliJ IDEA - CodenameOne - CEF path not found after AndroidStudio installation/JDK change?

I am having this issue on a Windows10 system.

I changed JDK to OpenJDK 1.8 to be able to send the Android build.

On the device the app is working although I have not tested the CEF Browser part for now.

On the simulator the app is executed, but blocked after the exception (a dialog is displayed).

Also if I revert to Oracle JDK11 the issue persists.

The app was regularly working. I also installed AndroidStudio on my system, maybe it has messed up with PATHs.

How can I fix this now?

(see log below)

Thanks

IntelliJ IDEA 2020.3.2 (Community Edition)
Build #IC-203.7148.57, built on January 26, 2021
Runtime version: 11.0.9.1+11-b1145.77 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 978M
Cores: 4
Non-Bundled Plugins: com.codename1.plugin.intellij, org.jetbrains.kotlin
"C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25\bin\java.exe" -Xms128m -Xmx1011m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -XX:CICompilerCount=2 -Dsun.io.useCanonPrefixCache=false -Djdk.http.auth.tunneling.disabledSchemes=\"\" -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djdk.attach.allowAttachSelf=true -Dkotlinx.coroutines.debug=off -Djdk.module.illegalAccess.silent=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.4\lib\idea_rt.jar=57718:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.4\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\user\IdeaProjects\myappcp\out\production\myappcp;C:\Users\user\IdeaProjects\myappcp\src;C:\Users\user\IdeaProjects\myappcp\lib\CodenameOne.jar;C:\Users\user\IdeaProjects\myappcp\JavaSE.jar;native\internal_tmp;lib\impl\cls com.codename1.impl.javase.Simulator com.myappcp.app.myapp
Adding CEF to classpath
Retina Scale: 1.0
[EDT] 0:0:4,330 - Codename One revisions: 7dd4e7d08b3442d90959477ee52a5ae8c4361b29

java.lang.RuntimeException: Failed to create CEF browser
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createCEFBrowserComponent(JavaCEFSEPort.java:130)
    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: no jcef in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    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.<init>(CefApp.java:149)
    at org.cef.CefApp.getInstance(CefApp.java:221)
    at com.codename1.impl.javase.cef.BrowserPanel.<init>(BrowserPanel.java:204)
    at com.codename1.impl.javase.cef.CEFBrowserComponent$3.<init>(CEFBrowserComponent.java:249)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:248)
    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:136)
    at com.codename1.impl.javase.cef.JavaCEFSEPort$2.run(JavaCEFSEPort.java:120)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    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)
[EDT] 0:0:4,409 - Exception: java.lang.RuntimeException - Failed to create CEF browser
[EDT] 0:0:6,490 - Exception: java.lang.RuntimeException - Failed to create CEF browser
java.lang.RuntimeException: Failed to create CEF browser
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createCEFBrowserComponent(JavaCEFSEPort.java:130)
    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.invokeAndBlock(Display.java:1453)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1492)
    at com.codename1.ui.Form.showModal(Form.java:2552)
    at com.codename1.ui.Dialog.showModal(Dialog.java:1139)
    at com.codename1.ui.Dialog.show(Dialog.java:583)
    at com.codename1.ui.Dialog.showPackedImpl(Dialog.java:1452)
    at com.codename1.ui.Dialog.showPacked(Dialog.java:1368)
    at com.codename1.ui.Dialog.showImpl(Dialog.java:1095)
    at com.codename1.ui.Dialog.show(Dialog.java:1073)
    at com.codename1.ui.Dialog.show(Dialog.java:1028)
    at com.codename1.ui.Dialog.show(Dialog.java:794)
    at com.codename1.ui.Dialog.show(Dialog.java:747)
    at com.codename1.ui.Dialog.show(Dialog.java:712)
    at com.codename1.ui.Dialog.show(Dialog.java:653)
    at com.codename1.ui.Dialog.show(Dialog.java:808)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:1175)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.UnsatisfiedLinkError: no jcef in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    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.<init>(CefApp.java:149)
    at org.cef.CefApp.getInstance(CefApp.java:221)
    at com.codename1.impl.javase.cef.BrowserPanel.<init>(BrowserPanel.java:204)
    at com.codename1.impl.javase.cef.CEFBrowserComponent$3.<init>(CEFBrowserComponent.java:249)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:248)
    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:136)
    at com.codename1.impl.javase.cef.JavaCEFSEPort$2.run(JavaCEFSEPort.java:120)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    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:130)
    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.invokeAndBlock(Display.java:1453)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1492)
    at com.codename1.ui.Form.showModal(Form.java:2552)
    at com.codename1.ui.Dialog.showModal(Dialog.java:1139)
    at com.codename1.ui.Dialog.show(Dialog.java:583)
    at com.codename1.ui.Dialog.showPackedImpl(Dialog.java:1452)
    at com.codename1.ui.Dialog.showPacked(Dialog.java:1368)
    at com.codename1.ui.Dialog.showImpl(Dialog.java:1095)
    at com.codename1.ui.Dialog.show(Dialog.java:1073)
    at com.codename1.ui.Dialog.show(Dialog.java:1028)
    at com.codename1.ui.Dialog.show(Dialog.java:794)
    at com.codename1.ui.Dialog.show(Dialog.java:747)
    at com.codename1.ui.Dialog.show(Dialog.java:712)
    at com.codename1.ui.Dialog.show(Dialog.java:653)
    at com.codename1.ui.Dialog.show(Dialog.java:808)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:1175)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.UnsatisfiedLinkError: no jcef in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    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.<init>(CefApp.java:149)
    at org.cef.CefApp.getInstance(CefApp.java:221)
    at com.codename1.impl.javase.cef.BrowserPanel.<init>(BrowserPanel.java:204)
    at com.codename1.impl.javase.cef.CEFBrowserComponent$3.<init>(CEFBrowserComponent.java:249)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:248)
    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:136)
    at com.codename1.impl.javase.cef.JavaCEFSEPort$2.run(JavaCEFSEPort.java:120)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    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)

Process finished with exit code 0

I reset the IDE and now I think the problem is:

Caused by: java.lang.UnsatisfiedLinkError: no jcef in java.library.path: [C:\Program Files\Java\jdk-11.0.2\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\Common Files\Oracle\Java\javapath, C:\Program Files (x86)\Intel\iCLS Client\, C:\Program Files\Intel\iCLS Client\, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\Intel\Intel(R) Management Engine Components\DAL, C:\Program Files\Intel\Intel(R) Management Engine Components\IPT, C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL, C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT, C:\Program Files\dotnet\, C:\Program Files\Microsoft SQL Server\130\Tools\Binn\, C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\, C:\Users\user\AppData\Local\Microsoft\WindowsApps, ., C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.4\bin, ., C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin, C:\Users\user\.dotnet\tools, C:\Users\user\AppData\Local\Box\Box Edit\, .]


Solution 1:[1]

I guess java.library.path has been changed or JCEF binaries are located elsewhere.

So, first you need to find out where JCEF binary distribution is. Usually this folder contains files:

  • libcef.dll
  • libEGL.dll,
  • libGLESv2.dll
  • libcef.dll
  • libjcef.dll
  • jcef_helper.exe

or *.so extension if you use unix base OS.

If you don't have binary distribution of JCEF you can build it from sources using this link. I want to warn you this is not easy journey. In the last step(packaging) you'll get binary_distrib directory

Second, your system already has configured the paths where it looking for the jcef binaries. You can see it in Exception details:

java.library.path: [C:\Program Files\Java\jdk-11.0.2\bin, C:\WINDOWS\Sun\Java\bin, ...

Or you can verify it by adding VM option to IDEA and run application again:

Edit Configurations -> Modify options -> Tick Add VM options -> In appeared field put -XshowSettings:properties

Third, You need to put JCEF binaries to one of these java.library.path

Hope this advice helps you

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1