Debug eclipse thread of native function in Visual Studio.

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

Re: Debug eclipse thread of native function in Visual Studio

Postby Arekkusu » Mon Sep 04, 2017 1:33 am

and I get this error too.
Attachments
Untitled.png
Untitled.png (9.28 KiB) Viewed 10114 times
Arekkusu
Techie
 
Posts: 20
Joined: Fri Aug 25, 2017 2:35 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Arekkusu » Mon Sep 04, 2017 2:03 am

Yes I have a newer one, 3.3029.1619.geeeb5d7.
And I'm running it on a x64 windows OS.
Arekkusu
Techie
 
Posts: 20
Joined: Fri Aug 25, 2017 2:35 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Phylanx » Mon Sep 04, 2017 2:43 am

We also use win64 machines, but with 32 bit java and jcef binaries.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Arekkusu » Mon Sep 04, 2017 2:51 am

I understand, it's better to use a x32 so that you'll make it compatible for both of them but whenever I load the chrome_elf and libcef.dll libraries into java I get the error of being unable to load IA 32-bit .dll on a AMD 64-bit platform if I want to load the x32 libraries.
Attachments
dsad.png
dsad.png (16.16 KiB) Viewed 10110 times
Arekkusu
Techie
 
Posts: 20
Joined: Fri Aug 25, 2017 2:35 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Phylanx » Mon Sep 04, 2017 9:35 am

Because if you use a 64 bit Java, you also have to use 64 bit DLLs.
If you use 32 bit Java, you have to use 32 bit DLLs.

You must not mix them, otherwise you get your behavior.

That means you also have to adapt your runtime native library path, so that 64 bit only gets 64 bit dlls and 32 bit only 32 bit.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Arekkusu » Mon Sep 04, 2017 11:40 am

Thank you very much, I'll try that...
How did you compile your (javacef.sln or fcef.sln) project, ( Debug x32 ) or (Release x32) ?
Arekkusu
Techie
 
Posts: 20
Joined: Fri Aug 25, 2017 2:35 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Phylanx » Tue Sep 05, 2017 1:20 am

I tried both, depending on what I needed at that moment.
To create these PDB files, you need to activate a simple flag, i just forgot which one it was.

Google might help there :D
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Arekkusu » Tue Sep 05, 2017 2:26 am

What version of cef_runtime have you used...
And can you confirm that the location from where I've taken the javacef.sln project was the same from where you took it?
I took it from here https://github.com/inaauto/javacef/tree/master .
Arekkusu
Techie
 
Posts: 20
Joined: Fri Aug 25, 2017 2:35 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Arekkusu » Tue Sep 05, 2017 2:52 am

But either way...
I'm currently in the process of finding what the problem is with the c++ build and I'm running in parallel eclipse and visual studio...

I get to a point in eclipse where I initialize a new thread and that thread goes into the c++ project code, chromium_loader_win.cc and it calls the JNIEXPORTED function Java_org_embedded_browser_Chromium_browser_1init(...) ...
Code: Select all
JNIEXPORT void JNICALL Java_org_embedded_browser_Chromium_browser_1init
  (JNIEnv *env, jobject jobj, jlong hwnd, jstring url, jobject chromiumset)
{
  // Enable High-DPI support on Windows 7 or newer.
  //CefEnableHighDPISupport();
  CefMainArgs main_args(GetModuleHandle(NULL));
  CefRefPtr<client::ClientApp> app(new client::ClientAppBrowser);

  // Parse command line arguments. The passed in values are ignored on Windows.
  //AppInitCommandLine(0, NULL);
  CefRefPtr<CefCommandLine> command_line = CefCommandLine::CreateCommandLine();
  command_line->InitFromString(::GetCommandLineW());

  // Create the main context object.
  scoped_ptr<client::MainContextImpl> context(new client::MainContextImpl(command_line, false));

  CefSettings settings;

  // Populate the settings based on command line arguments.
  //AppGetSettings(settings);

  // Populate the settings based on argument provided from Java
  populate_cef_settings(env, chromiumset, settings);

  // if set to true, the process crashes in SWT
  settings.multi_threaded_message_loop = false;

  // Initialize CEF.
  //CefInitialize(main_args, settings, app.get(), NULL);
  context->Initialize(main_args, settings, app.get(), NULL);

  HWND hMain;
  hMain = (HWND)((void*)hwnd);

  const char* chr = env->GetStringUTFChars(url, 0);

  CefString wc = chr;
  CefRefPtr<ClientHandler> gh = NewBrowser(hMain, wc);
  gh->id = 1;

  env->ReleaseStringUTFChars(url, chr);
  // NOTE: This function (browser_init) should only be called ONCE in one process,
  // which means to call CefInitialize in the first browser creation, and call
  // CefShutdown in the exit of the process. Repeated calls to this function will
  // NOT work, because the web page will not render. Most probably a bug in cef.
  set_jvm(env, jobj);
  send_handler(env, jobj, (jlong)(void*)gh);
  // Have to be here and use own jnienv to avoid errors.
  get_browser_settings(env, chromiumset, gh->csettings);
  if (gh->csettings.run_modal_message_loop_in_init) {
    // Run the CEF message loop. This function will block until the application
    // recieves a WM_QUIT message.
    message_loop = new client::MainMessageLoopStd;
    message_loop->Run();
    //CefRunMessageLoop();
    cleanup_jvm(env);
    //CefShutdown();
    context->Shutdown();
  }

  DLOG(INFO) << "Exit init method!";
}

in there I get to a function that tries to initialize CEF from its main C build getting me to libcef_dll_wrapper.cc and calling CefInitialize, next there's an int value _retval which calls the c based function to initialize cef (cef_initialize) and here is where the window that says "that I can't create The Java Virtual Machine " happens.
Code: Select all
CEF_GLOBAL bool CefInitialize(const CefMainArgs& args,
    const CefSettings& settings, CefRefPtr<CefApp> application,
    void* windows_sandbox_info) {
  const char* api_hash = cef_api_hash(0);
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Unverified params: application, windows_sandbox_info
  // Execute
  int _retval = cef_initialize(
        &args,
        &settings,
        CefAppCppToC::Wrap(application),
        windows_sandbox_info);
  return _retval?true:false;
}



What can I do ? Has anyone ever had this problem ?
Attachments
qwe.png
qwe.png (7.65 KiB) Viewed 10100 times
Arekkusu
Techie
 
Posts: 20
Joined: Fri Aug 25, 2017 2:35 am

Re: Debug eclipse thread of native function in Visual Studio

Postby Phylanx » Wed Sep 06, 2017 1:05 am

At first:
I followed the instructions found here (Branches and Building) to create my own windows build:
https://bitbucket.org/chromiumembedded/ ... ndBuilding

As far as I know, the chromium initialization has to happen in the AWT EventQueue (use SwingUtilities.invokeAndWait/invokeLater for this purpose).

For the JVM crash:
Have you found the hs_err file?
This is a crash report dump that gives more information than a simple "Oh no, it crashed!"-like message.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

PreviousNext

Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 18 guests