Page 1 of 1

JCEF set jre/bin folder other than system path

PostPosted: Mon Oct 27, 2014 5:40 am
by cleagaeb
Hi all,

As for now I have a nice java application which includes JCEF and which opens the browser and everything is fine. I found out that it is necessary to set the java jre/bin folder in the system environment path variable else i get an error: UnsatisfiedLinkError: no jcef in java.library.path when the jcef.dll is loaded.

I don't know which file or what the jcef.dll needs from the jre/bin path but unless I set it, it won't work. Setting the jre/bin path in the java.library.path also did NOT work.

Now I deliver my application with an own java rt folder. It is no problem to add this folder to the system environment variable BUT if there is already an other java bin folder set i get into big trouble, especially if it's not java 7 and 64bit.

So the question would be:
Is there another possibility to supply my application with the jre/bin path than via the system environment variables? At its best I want to point to the jre/bin folder i deliver with the application.

Thanks in advance!

Re: JCEF set jre/bin folder other than system path

PostPosted: Mon Oct 27, 2014 10:06 am
by magreenblatt
What JCEF version are you using? It may have been fixed in https://code.google.com/p/javachromiume ... ail?id=118.

Re: JCEF set jre/bin folder other than system path

PostPosted: Mon Oct 27, 2014 10:47 am
by cleagaeb
Hi,

I'm using the version 3.1750.1738.91.

I fear that this issue is not the problem but I gonna try and compile a new version of jcef. I tried loading the jawt before loading the others but this did not do the job (jawt.dll: Can't find dependent libraries).

I tried following combinations:
1) set no java.library.path | set no path variable => ERROR: icudt not found
2) set java.library.path to jcef dlls | set no path variable => ERROR: no jcef in java.library.path (where it's obvious that the path is correct to the jceff.dll as the icudt is found so I suspect the jcef.dll was not loaded correctly)
3) set java.library.path to jcef dlls | set path to only! jre/bin of my jdk => WORKING: browser pops up, site is loaded, everything works perfect
4) set java.library.path to jcef dlls and jre/bin | ERROR same behaviour as in 2.)

Code: Select all
public class Main {

   public static void main(String[] args) throws Exception {

      System.setProperty("java.library.path","<path>\\jre\\bin;<path>\\dll\\jcef");
      // Set to null so the path is reloaded
      Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
      fieldSysPath.setAccessible(true);
      fieldSysPath.set(null, null);

      System.out.println(System.getenv("Path"));

      System.loadLibrary("icudt");
      System.loadLibrary("libcef");
      System.loadLibrary("jcef");

      System.out.println("Done");
   }
}

Re: JCEF set jre/bin folder other than system path

PostPosted: Mon Oct 27, 2014 11:28 am
by cleagaeb
Just built jcef (Rev. 110) with cef (3.1916.1749) and I still got the same problem. As soon as I set the path to the jre/bin via windows path it works, but I find no other way than to define it via path variable.

Gonna continue testing tomorrow.

Thanx for your help

Re: JCEF set jre/bin folder other than system path

PostPosted: Mon Oct 27, 2014 11:51 am
by magreenblatt
Have you tried setting the PATH variable in the bat file (set PATH=...) before calling java?

Re: JCEF set jre/bin folder other than system path

PostPosted: Tue Oct 28, 2014 4:23 am
by cleagaeb
Well it's working now.

After packing the jcef.jar and uploading it to our artifactory, I forgot to update with mvn -U.

Now it's working! Thanks for your help!

Re: JCEF set jre/bin folder other than system path

PostPosted: Sat Jun 29, 2019 3:45 pm
by magreenblatt
I'm able to reproduce this problem when trying to load JCEF via JUnit Console Launcher. It only works if I set PATH and java.library.path exactly as you describe in step 3:

Code: Select all
set PATH="C:\Program Files\Java\jre1.8.0_71\bin"
java -Djava.library.path=.\jcef_build\native\Release -jar .\third_party\junit\junit-platform-console-standalone-1.4.2.jar -cp .\out\win64 --select-package tests.junittests


In my case it doesn't seem to make a difference if the class files are in a JAR, I still need to set PATH in the same way (except for some reason --select-package no longer discovers any test cases, so I'm using --select-class instead):

Code: Select all
set PATH="C:\Program Files\Java\jre1.8.0_71\bin"
java -Djava.library.path=.\bin\lib\win64 -jar .\bin\junit-platform-console-standalone-1.4.2.jar -cp .\bin\jcef.jar;.\bin\jcef-tests.jar --select-class tests.junittests.TestCase1

Re: JCEF set jre/bin folder other than system path

PostPosted: Sat Jun 29, 2019 6:25 pm
by magreenblatt
It seems to work provided the full Java path (e.g. "C:\Program Files\Java\jre1.8.0_71\bin") is first in your PATH variable. It doesn't have to be the only value in PATH. On Windows the Java PATH is often set to "C:\ProgramData\Oracle\Java\javapath" (which contains a shortcut to java.exe), and that doesn't work in this case.