I'm developing a web app using Spring MVC with Maven and with some functionality using tess4j for the OCR.
My dev environment:
Eclipse Neon.3
os: win server 2008R2
jvm 64 bit
apache tomecat 9
I downloaded the latest version of Tess4J from http://tess4j.sourceforge.net/ and imported it into eclipse. I am following this URL, I followed all the steps but when I try to execute it I am getting the following error:
java.lang.UnsatisfiedLinkError: Le module spécifié est introuvable.
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:75)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:367)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:280)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:212)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:196)
I try to some tutorial and i add:
.MV C++ 2015 Redistributable (x64)
.I add on C:\Program Files (x86)\Apache Software Foundation\Tomcat 9.0\temp\tess4j\win32-x86-64
I still have the error.
What is essentially happening is System is not able to find a native module called 'spécifié' (I think, I can't read French) to load. Now the mechanics is like this. during load time somewhere (probably in the jar) a call is being made like
System.loadLibrary("spécifié");
Which is failing because the native library is not on PATH. So a simple solution would be to put the module on PATH. If it is an Windows environment, then the module would be a DLL file called spécifié.dll. This file must be placed on the path (e.g. set PATH=C:\xyz\spécifié.dll).
Try it and check.
Related
I run my program in suse 11 operation system. The JRE is OpenJDK 8u-191. The program runs smoothly except kaptcha for login. When I login the page will show me the kaptcha, but an exception occurs.
java.lang.UnsatisfiedLinkError: /usr/local/java8/jre-8u191/lib/amd64/libfontmanager.so: libfreetype.so.6: cannot open shared object file no such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
...
Is the libfreetype.so.6 in OpenJDK? I can't find it. Should I download the libfreetype.so.6 from internet?
This is part of libfreetype6 and you can find it here https://software.opensuse.org/package/libfreetype6
I am trying to build OpenCV from source to .jar, since I need to have some contributed libs like Aruco (and these do not come with the default download from OpenCV.
Following a tutorial, I set up CMake, and configuring gives the following (pieces of) output:
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc java java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: js python3 world
Disabled by dependency: -
Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern freetype hdf matlab ovis python2 python2 sfm viz
Applications: perf_tests apps
Documentation: NO
Non-free algorithms: YES
...
Java:
ant: C:/opencv-3.4.1/apache-ant-1.10.5-bin/bin/ant.bat (ver 1.8.0)
JNI: C:/Program Files/Java/jdk1.8.0_171/include C:/Program Files/Java/jdk1.8.0_171/include/win32 C:/Program Files/Java/jdk1.8.0_171/include
Java wrappers: YES
Java tests: NO
Then after I run mingw32-make in the build folder configured by CMake, it builds without errors. Then in the build/bin folder I do find the opencv-341.jar file as expected.
When I link this library in my IntelliJ IDEA, the modules like org.opencv.aruco are recognised, as expected. However when trying to build the java project, I get this error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_java341 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at AraInvaders.Main.main(Main.java:24)
... 11 more
After some research I figured that I forgot to link the native library location, as was also described in the tutorial. However according to that tutorial (and other resources), the build should include a build/java/x64 folder, containing a .dll file, however there is no build/java folder at all.
I do find a libopencv_java341.dll in build/lib however, linking that file does not resolve the problem. Image showing that .dll file is linked
When I download the Windows package form OpenCV, there is a Java folder in the build folder, and that does include the .jar file and an /x64 folder, however, those do not include the contributed libs, so that is why I am trying to build from source.
So the question is, what should I do to correctly setup the OpenCV library, including the contributed libs?
I asked on OpenCV forum http://answers.opencv.org/question/210451/opencv-401-face-module-for-java/.
So there are two solutions:
Since you built dynamically OpenCV libs, opencv_java.dll depends on opencv_core.dll, opencv_imgproc.dll, etc... you have to append the folder containing those to your system's PATH
Turn off BUILD_SHARED_LIBS flag and build everything again.
I renamed the generated dll from libopencv_java412.dll to opencv_java412.dll and it resolved the problem of library path problem ("UnsatisfiedLinkError").
The 412 in the file name is because I'm using OpenCV 4.1.2.
Downloading and using tessData-best for tesseract-ocr github repository improved my accuracy for english on Tess4j 3.8.4 significantly. But to use that trainedData for other languages i had to upgrade to Tess4J 4.0.0. But When I did that its giving me following error on this line
TessBaseAPI api = TessAPI1.TessBaseAPICreate();
Exception in thread "main" java.lang.UnsatisfiedLinkError: The specified module could not be found.
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Native.register(Native.java:1396)
at com.sun.jna.Native.register(Native.java:1156)
at net.sourceforge.tess4j.TessAPI1.<clinit>(TessAPI1.java:41)
at OCR.confidenceWord(OCR.java:106)
at OCR.processImg(OCR.java:381)
at test.main(test.java:10)
I have 64-bit windows 8.1 running on my machine with 64-bit JVM. I have VC++ 2015 redistributable installed. I checked in dependency walker and no dll seems to be missing.By setting system property "jna.debug.load" to "true", I can see it properly looks for and gets "libtesseract400" at temp folder. Has anyone been able to solve this error?
I am using a library that requires that I load load dynamic linking libraries. My source code that uses these libraries is identical, the only difference is the operating system that I am using and which version of the library (Windows-64 version or Linux-64 version) that I am using. The library I am using provides 1 set for Windows ".dll" files and 1 set for Linux ".so" files, each in its own folder. To load the Linux ".so" libraries, I do
"-Djava.library.path=/home/johnmichaelreed/Desktop/Dropbox/Moved_Netbeans_Projects/Crazy_Client/Libjitsi_linux_64/lib/native/linux-64"
in the VM options and everything works.
Then, when I copy and paste the directory where the Windows ".dll" native libraries are into the VM options, I get rid of the Linux libraries path and insert:
-Djava.library.path=C:\Users\JohnReedLOL\Desktop\Dropbox\Moved_Netbeans_Projects\Crazy_Client\Libjitsi_windows_64\lib\windows_native\windows-64
I then change the library JAR files to the ones that came with the Windows version of the Library and I run the program and I get this error:
SEVERE: Failed to register custom Renderer org.jitsi.impl.neomedia.jmfext.media.renderer.video.JAWTRenderer with JMF.
java.lang.UnsatisfiedLinkError: C:\Users\JohnReedLOL\Desktop\Crazy_Client\Libjitsi_windows_64\lib\windows_native\windows-64\jnawtrenderer.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1855)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at org.jitsi.impl.neomedia.jmfext.media.renderer.video.JAWTRenderer.<clinit>(JAWTRenderer.java:90)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at org.jitsi.impl.neomedia.device.DeviceConfiguration.registerCustomRenderers(DeviceConfiguration.java:1034)
at org.jitsi.impl.neomedia.device.DeviceConfiguration.<init>(DeviceConfiguration.java:355)
at org.jitsi.impl.neomedia.MediaServiceImpl.<init>(MediaServiceImpl.java:150)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:438)
at org.jitsi.impl.libjitsi.LibJitsiImpl.getService(LibJitsiImpl.java:142)
at org.jitsi.service.libjitsi.LibJitsi.invokeGetServiceOnImpl(LibJitsi.java:163)
at org.jitsi.service.libjitsi.LibJitsi.getMediaService(LibJitsi.java:115)
at outermost_crazy.Libjitsi_Main.<init>(Libjitsi_Main.java:124)
at outermost_crazy.Libjitsi_Main.main(Libjitsi_Main.java:827)
The weird thing is I am 100% sure that the native library path is the right place because when I print it using System.getProperty("java.library.path"), I get the folder:
C:\Users\JohnReedLOL\Desktop\Dropbox\Moved_Netbeans_Projects\Crazy_Client\Libjitsi_windows_64\lib\windows_native\windows-64
^ This folder definitely has all 12 .dll files ^. The library JAR files that I am using are the ones the ones that came with these 12 ".dll" files, not the ones that came with the Linux ".so" files, so I am pretty sure that I am using the right JAR files. Why this is error only happening on Windows with the .dll files, but not on Linux with the .so files?
Dependency Walker opening of jnawtrenderer.dll:
Can you please tell me the solution to fix this below issue ---
This Exception I am getting while trying to connect SAP related files through Java class even though sapjco3.jar is in my library path.I tried this in Windows XP & Windows Server 98.
java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at com.sap.conn.jco.rt.DefaultJCoRuntime.loadLibrary(DefaultJCoRuntime.java:441)
at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods(DefaultJCoRuntime.java:307)
at com.sap.conn.jco.rt.JCoRuntime.registerNatives(JCoRuntime.java:987)
at com.sap.conn.rfc.driver.CpicDriver.<clinit>(CpicDriver.java:948)
at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion(DefaultRfcRuntime.java:43)
at com.sap.conn.rfc.api.RfcApi.RfcGetVersion(RfcApi.java:259)
at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:200)
at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:73)
at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
at com.sap.conn.jco.rt.RuntimeEnvironment.<init>(RuntimeEnvironment.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at com.sap.conn.jco.ext.Environment.getInstance(Environment.java:121)
at com.sap.conn.jco.ext.Environment.registerDestinationDataProvider(Environment.java:216)
at de.vogella.sap.rfc.core.connection.Connection.<init>(Connection.java:37)
at struct.actions.GestReservaSap.<clinit>(GestReservaSap.java:63)
at eu.sony.com.moduloreservas.ReservasMainClass.main(ReservasMainClass.java:259)
The SAP Java Connector internally uses a native library to connect to SAP. This native library is not the sapjco3.jar but the sapjco3.dll (on Windows systems). I.e. the dll file must be in a folder which is in your Java library path.
The latter is a Java system property, you can access it in your application by calling
System.getProperty("java.library.path")
Then you can put the sapjco3.dll either into one of the folders which are already in your library path (on Windows e.g. something like C:\WINNT\system32) or the other way around set the library path to a specific folder by explicitly setting the library path:
in the application code by setting
System.setProperty("java.library.path", "C:\path\to\folder\with\dll\")
before accessing the SAP JCo
or when starting Java with the command line argument
-Djava.library.path=C:\path\to\folder\with\dll\
Since putting the dll into a system specific folder like winnt\system32 may have effects not only to your application but to others as well, it is recommended to add the folder containing the sapjco3.dll to your application's library path. The more flexible way is to specify it via the command line as shown above so you don't have it hard coded.