Java CEF IntelliJ plugin support UnsatisfiedLinkError on init (Linux) Follow
I am working on Java Chromium Embedded Framework https://bitbucket.org/chromiumembedded/java-cef/src/master/. I aim to embed the browser into IntelliJ IDEA plugins for Windows and Linux.
I build native library parts from source code. Project example apps work both Win and Linux, but when I embed it into IntelliJ IDEA it crashes on Ubuntu at initialization method (works on windows though). Previously I had some issues on Windows and was able to debug C++ code with Visual Studio. Now I am not sure how to debug on Ubuntu.
On Linux I use cmake and make to build the library:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug.. make -j4
Init crash error stack trace:
java.lang.UnsatisfiedLinkError: org.cef.CefApp.N_PreInitialize()Z at org.cef.CefApp.N_PreInitialize(Native Method) at org.cef.CefApp.access$000(CefApp.java:24) at org.cef.CefApp$1.run(CefApp.java:162) at org.cef.CefApp.<init>(CefApp.java:167) at org.cef.CefApp.getInstance(CefApp.java:220) at org.cef.CefApp.getInstance(CefApp.java:207) ...
I tried loading my lib with jna.library.path, LD_LIBRARY_PATH, adding to class path; but neither works on Ubuntu (as suggested here https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000123070--Jar-with-native-libraries-is-not-added-to-the-runtime-classpath-thru-module-dependencies)
On JCEF forum there is thread with similar issues on Linux (https://github.com/CodeBrig/Journey/issues/3), but no good tips on debugging. Any suggestions would be appreciated, thank you
Please sign in to leave a comment.
1. JCEF doesn't use JNA but JNI to access the native lib. So, you should set java.library.path (not jna).
2. Make sure you deploy jcef.jar and libjcef.so of the same JCEF build.
3. Call CefApp.startup() at the beginning of JCEF initialisation to let it load libjcef.so
Anton, thank you for the answer. The IDE crashes right after CefApp.startup().
Well, JCEF is capricious. I can't say exactly what made it crash in your case... I can only suggest that you follow this ticket: https://youtrack.jetbrains.com/issue/JBR-1603
We have develop a plugin which integrate jcef , most time it works well , but sometimes it will crash intellij on mac os. Anton, do you have some experience about this, please help me.