VietOCR3 icon indicating copy to clipboard operation
VietOCR3 copied to clipboard

Could not find library [libjsane.so]

Open brucewoo opened this issue 7 years ago • 4 comments

JarLib.load Error = java.lang.UnsatisfiedLinkError: uk.co.mmscomputing.util.JarLib.loadX: Could not find library [libjsane.so] JarLib.load Error = java.lang.UnsatisfiedLinkError: uk.co.mmscomputing.util.JarLib.loadX: Could not find library [libjsane.so] java.lang.UnsatisfiedLinkError: uk.co.mmscomputing.util.JarLib.loadX: Could not find library [libjsane.so] at uk.co.mmscomputing.util.JarLib.loadX(JarLib.java:40) at uk.co.mmscomputing.util.JarLib.load(JarLib.java:10) at uk.co.mmscomputing.device.sane.jsane.(jsane.java:140) at uk.co.mmscomputing.device.sane.SaneScanner.isAPIInstalled(SaneScanner.java:17) at uk.co.mmscomputing.device.scanner.Scanner.getDevice(Scanner.java:86) at net.sourceforge.vietocr.GuiWithScan$1.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at org.GNOME.Accessibility.AtkWrapper$5.dispatchEvent(AtkWrapper.java:700) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) JarLib.load Error = java.lang.UnsatisfiedLinkError: no jsane in java.library.path JarLib.load Error = java.lang.UnsatisfiedLinkError: no jsane in java.library.path java.lang.UnsatisfiedLinkError: no jsane 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 uk.co.mmscomputing.util.JarLib.load(JarLib.java:22) at uk.co.mmscomputing.device.sane.jsane.(jsane.java:140) at uk.co.mmscomputing.device.sane.SaneScanner.isAPIInstalled(SaneScanner.java:17) at uk.co.mmscomputing.device.scanner.Scanner.getDevice(Scanner.java:86) at net.sourceforge.vietocr.GuiWithScan$1.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at org.GNOME.Accessibility.AtkWrapper$5.dispatchEvent(AtkWrapper.java:700) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 00:13:02.931 [AWT-EventQueue-1] ERROR net.sourceforge.vietocr.GuiWithScan - null java.lang.NullPointerException: null at net.sourceforge.vietocr.GuiWithScan$1.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at org.GNOME.Accessibility.AtkWrapper$5.dispatchEvent(AtkWrapper.java:700) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

brucewoo avatar Apr 02 '18 16:04 brucewoo

The doc states: "On Linux, scanning requires installation of SANE packages." Have you installed it?

nguyenq avatar Apr 03 '18 02:04 nguyenq

It was recently discovered that the jsane library, the java wrapper to the SANE functions, only works with Linux 32-bit. Running it on Linux 64-bit will throw UnsatisfiedLinkError exceptions. It looks like a libjsane.so has to be compiled for 64-bit.

Background: http://imagej.1557.x6.nabble.com/Scan-does-not-scan-td3685074.html Source: http://thorntonzone.com/manuals/Compression/Fax,%20IBM%20MMR/MMSC/mmsc/uk/co/mmscomputing/device/sane/index.html

nguyenq avatar Nov 01 '18 05:11 nguyenq

We can recompile the library on Linux Ubuntu 64-bit, but it looks like some change to the source code is necessary as UnsatisfiedLinkError exceptions still happen. Need JNI expert help!

nguyenq avatar Feb 01 '21 14:02 nguyenq

In my opinion you should leave out the scan option in the GUI. The uk.co.mmscomputing.device.sane.jar is too old for modern java ... Nevertheless I gave it a try: As outlined you need lin64 code. I fetched it from ttps://github.com/julian554/jscan/tree/master/src/main/java/uk/co/mmscomputing/device/sane/lin64, corrected the location of some include files and replaced libsane.so in jsane.cpp by libsane.so.1. Now build lib with g++ -Wall -fPIC -fpermissive -pthread -D_REENTRANT -D_GNU_SOURCE -shared -o libjsane.so jsane.cpp jdesc.cpp jnu.cpp and get 64-bit libjsane.so . I copied this into /usr/lib so that it can be found by the program. Starting the JAR the above error messages are gone BUT I get a fatal error detected by the Java Runtime Environment ( SIGSEGV fault ). Here I gave up.

ekuester avatar Jan 17 '22 11:01 ekuester