B4J Question Standalone Package11 don’t run with lib jOpenCV


Active Member
Licensed User
Longtime User
I use the eminent Build Standalone Package11.
It has worked well until I use the lib routine jOpenCV.jar. Then I get the error below.

Have study ' The simple wav to distribute standalone spps' Can't find a solution!
Tried with
Private InputJar As String = "C:\D\Program\Anywhere Software\B4J\Libraries\jOpenCV.jar" in Process Globals. Not working

How do I get on...
Using IDE 9.30, B4Jpackage11 1,4 och Java 11

run run Debug.bat show
C:\D\Program\B4J\Server\ABMServer\ImageOnImageTester\Objects\temp\build\bin>java.exe @release_java_modules.txt -m b4j/b4j.example.main
Init jOpenCV 344.01 Core...
main._process_globals (java line: -1)
java.lang.UnsatisfiedLinkError: no b4jcv_344_01 in java.library.path: [C:\D\Program\B4J\Server\ABMServer\ImageOnImageTester\Objects\temp\build\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\, C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL, C:\Program Files\Intel\Intel(R) Management Engine Components\DAL, C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT, C:\Program Files\Intel\Intel(R) Management Engine Components\IPT, C:\Program Files\Intel\WiFi\bin\, C:\Program Files\Common Files\Intel\WirelessCommon\, C:\Users\johne\AppData\Local\Microsoft\WindowsApps, ., .]
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.loadLibrary0(Unknown Source)
at java.base/java.lang.System.loadLibrary(Unknown Source)
at b4j/com.b4jcv.core.Core.<clinit>(Unknown Source)
at b4j/b4j.example.main._process_globals(Unknown Source)
at b4j/b4j.example.main.initializeProcessGlobals(Unknown Source)
at b4j/b4j.example.main.start(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(Unknown Source)

at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)

at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)

at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)


Well-Known Member
Licensed User
Longtime User
I've never used the Packager11, so don't know how it works.

What jOpencv needs is to find the DLLs attached to the project (b4jcv_344_01.dll and others)

In your case, it is failing to find b4jcv_344_01.dll in the Java path directories. Usually it looks for them in the same directory where the executable is, or in the Java classPath.
With the previous packager (*), these DLLs were copied to the bin folder of the packaged project, so it always worked. You'll have to do the equivalent with Packager11

(*) Here is what was made in the examples.
' REQUIRED for jOpenCV. 
' This will copy the required DLLs to App dir. Change accordingly to the location of the DLLs folder.
' Alternatively, you can also manually place the DLLS there, or in a folder that is in the java classpath. 
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\jOpenCVDlls" "."
' If you want to distribute it as a standalone package, copy your DLLs to the projects root folder
' DLL names can vary in other jOpenCV versions so be sure to modify accordingly.
#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ b4jcv_344_01.dll
#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ opencv_ffmpeg344_64.dll
#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ tbb12.dll
Upvote 0


Active Member
Licensed User
Longtime User
Happy to see your answer, many thanks!

Your suggestion works!
However, one problem remained that has nothing to do with OpenCV, this is because I try to use #CommandLineArgs:. Apparently, CommandLineArgs is not allowed to use in a Stand alone package! I solve this by communicating data through files!
I'm not good at build standallone package either! Maybe it's going to get better!
Thanks very much!
Upvote 0