-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loader.load(opencv_java.class) looking for the entire Path in Windows #454
Comments
To disable that behavior, set the "java.library.path" system property to an empty string. |
It has no impact. See below:
Shows, the following: 09:48:23.759 INFO a.s.d.s.c.a.c.model.OpenCVModel - Loading - OpenCV Library But I still see the following in the logs:
I believe the issue is with the following in Loader.java:
The System.loadLibrary will use the setting of the running JVM and java.library.path has no impact on it. There needs to be a switch to disable any external paths and System.loadLibrary perhaps. |
Yes, we can set the java.library.path system property. You're probably running JavaCPP in a different JVM than Maven. |
It should be in the same JVM. Right before the Loader.load, I know the java.library.path is empty. The issue is that we need to set a different switch to prevent the code to trigger the System.loadLibrary(libname) because we can't control the path it uses. This should be fixed in the Loader.java class. mvn -f ....\pom.xml test -Pservice -Dorg.bytedeco.javacpp.logger.debug=true -Djava.library.path="" |
Hum, ok, maybe we could hack it something like this way: if (!loadedByLoadLibrary0 && System.getProperty("java.library.path", "").length() > 0) {
System.loadLibrary(libname); If this does what you need, please send a pull request to that effect! |
I would recommend a new switch org.bytedeco.javacpp.systemLoadLibrary. We can default it to true for backward compatibility so existing applications do not break. Please let me know if that works. |
Just created a pull request. #456 |
Removed the switch. See pull request. #457
|
BTW, I can't reproduce this issue, works fine here: #456 (comment) |
Loading Loader.load(opencv_java.class) takes 10 seconds on windows and on debug enabled, the Loader is searching all possible Paths: For .e.g with org.bytedeco.javac=true, I see the following:
Debug: Failed to load for opencv_cudaimgproc440: java.lang.UnsatisfiedLinkError: no opencv_cudaimgproc440 in java.library.path: [C:\Program Files\AdoptOpenJDK\jdk-11.0.9.101-hotspot\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\AdoptOpenJDK\jdk-11.0.9.101-hotspot\bin, C:\Program Files (x86)\Razer\ChromaBroadcast\bin, C:\Program Files\Razer\ChromaBroadcast\bin, C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler, C:\Prog
It does find the libraries but not sure searching for all possible directories in PATH is the way to go.
The text was updated successfully, but these errors were encountered: