Cannot build JCEF : Ident. GetJNIEnv()

Having problems with building or using the JCEF Java binding? Ask your questions here.

Cannot build JCEF : Ident. GetJNIEnv()

Postby fmatz » Sun Nov 22, 2020 5:10 pm

Hi,

I cannot create JCEF https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding :

Severity Code Description Project Path File Line Suppression State
Error (active) E0020 identifier "GetJNIEnv" is undefined jcef ..\src\native ..\src\native\request_handler.cpp 67

JNIEnv* env = GetJNIEnv();
if (!env)
return false;


What can I do ?

Regards,
Friedhold
fmatz
Newbie
 
Posts: 5
Joined: Thu Jan 23, 2020 1:37 pm

Re: Cannot build JCEF : Ident. GetJNIEnv()

Postby magreenblatt » Sun Nov 22, 2020 10:48 pm

You can apply this fix:

Code: Select all
 diff --git a/native/request_handler.cpp b/native/request_handler.cpp
index 5553662..a886338 100644
--- a/native/request_handler.cpp
+++ b/native/request_handler.cpp
@@ -64,7 +64,7 @@ bool RequestHandler::OnOpenURLFromTab(CefRefPtr<CefBrowser> browser,
                                       const CefString& target_url,
                                       WindowOpenDisposition target_disposition,
                                       bool user_gesture) {
-  JNIEnv* env = GetJNIEnv();
+  ScopedJNIEnv env;
   if (!env)
     return false;
 
magreenblatt
Site Admin
 
Posts: 10919
Joined: Fri May 29, 2009 6:57 pm

Re: Cannot build JCEF : Ident. GetJNIEnv()

Postby fmatz » Mon Nov 23, 2020 4:37 am

Thank you and great,

this works now!

Best Greetings,
Friedhold
fmatz
Newbie
 
Posts: 5
Joined: Thu Jan 23, 2020 1:37 pm

Re: Cannot build JCEF : Ident. GetJNIEnv()

Postby pfrigge » Mon Nov 23, 2020 6:20 am

I had the same problem. So thank you both, fmatz and magreenblatt!

I submitted a (not yet approved) post with basically the same question on a new thread some hours ago. Because yesterday when I searched for a solution this thread wasn't available yet or I overlooked it. Therefore my thread may be deleted or stay unapproved. Thanks again.
pfrigge
Newbie
 
Posts: 2
Joined: Mon Nov 23, 2020 3:23 am

Re: Cannot build JCEF : Ident. GetJNIEnv()

Postby magreenblatt » Mon Nov 23, 2020 12:18 pm

magreenblatt
Site Admin
 
Posts: 10919
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 2 guests

cron