Tess4j unsatisfied link error on mac OS X
Hey i am trying to use tess4j for tesseract and having this issue for eclipse on mac osx .
My tesseract is working fine from terminal but trying to run tess4j through tesseract throws me an error .
java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': Native library (darwin/libtesseract.dylib)
i do have tessetact dylib and its named libtesseract.dylib in my opt/local/lib which i installed using macport .
Thanks for your help
java tesseract
add a comment |
Hey i am trying to use tess4j for tesseract and having this issue for eclipse on mac osx .
My tesseract is working fine from terminal but trying to run tess4j through tesseract throws me an error .
java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': Native library (darwin/libtesseract.dylib)
i do have tessetact dylib and its named libtesseract.dylib in my opt/local/lib which i installed using macport .
Thanks for your help
java tesseract
add a comment |
Hey i am trying to use tess4j for tesseract and having this issue for eclipse on mac osx .
My tesseract is working fine from terminal but trying to run tess4j through tesseract throws me an error .
java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': Native library (darwin/libtesseract.dylib)
i do have tessetact dylib and its named libtesseract.dylib in my opt/local/lib which i installed using macport .
Thanks for your help
java tesseract
Hey i am trying to use tess4j for tesseract and having this issue for eclipse on mac osx .
My tesseract is working fine from terminal but trying to run tess4j through tesseract throws me an error .
java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': Native library (darwin/libtesseract.dylib)
i do have tessetact dylib and its named libtesseract.dylib in my opt/local/lib which i installed using macport .
Thanks for your help
java tesseract
java tesseract
edited Jan 28 '14 at 1:20
nestrocuation
asked Jan 28 '14 at 0:20
nestrocuationnestrocuation
8928
8928
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
I know it's an old post. I had this problem too recently when I tried to use Tess4J
. However, I managed to find a way around it. I've written a post about it http://www.microshell.com/programming/java/performing-optical-character-recognition-in-java/
In short, the problem is because tess4j-2.0.0.jar
doesn't include MacOS library. So I just modified the maven cached jar on mine by doing these steps:
cd /Users/user/.m2/repository/net/sourceforge/tess4j/tess4j/2.0.0
(adjust the directory where your tess4j JAR file resides)mkdir darwin
jar uf tess4j-2.0.0.jar darwin
cp /opt/local/lib/libtesseract.3.dylib darwin/libtesseract.dylib
jar uf tess4j-2.0.0.jar darwin/libtesseract.dylib
jar tf tess4j-2.0.0.jar
(to verify that the file is included)
I was then able to run my Java program after I modify the tess4j-2.0.0.jar
file. Below is my MacOS version.
user@laptop:~$ uname -a
Darwin Maresas-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
add a comment |
You need install the tesseract lib on your Mac.
brew install tesseract --with-all-languages
add a comment |
I had a very similar issue with Ghost4j, i.e.
InvocationTargetException: Unable to load library 'gs': Native library (darwin/libgs.dylib) not found in resource path
Instead of modifying jar files, point jna to the appropriate lib path by setting jna.library.path
. In Eclipse, you need to set the system property in run configurations - SO answer for this here - https://stackoverflow.com/a/862405/2163229
If you're using Maven exec:
mvn -Djna.library.path=/opt/local/lib/ exec:java -Dexec.mainClass="foo.bar.NativeThingy"
or
export MAVEN_OPTS="-Djna.library.path=/opt/local/lib/" && mvn exec:java -Dexec.mainClass="foo.bar.NativeThingy"
Obviously, set the path to wherever your libs are installed. In my case, I ran $ locate libgs.dylib
and found the above path.
References:
https://jna.java.net/javadoc/com/sun/jna/NativeLibrary.html
add a comment |
Make sure you use libtesseract.dylib
of Tesseract 3.02 version. Check out this post on Tesseract Forum.
I am using version 3.02.02, and i checked that post out before but it does not work. And i also added the java -Djava.library.path as vm argument . Can 64 bit jvm throw this error
– nestrocuation
Jan 28 '14 at 2:55
1
Very possible. Tesseract and Leptonica are 32-bit libraries. Could take quite a bit of work to compile them to 64-bit.
– nguyenq
Jan 28 '14 at 3:14
add a comment |
This is exactly what I was after today, so thanks for the Q&A above. As one additional step beyond what maresa mentioned, I ran into this error after fixing the one you asked about:
java.lang.UnsatisfiedLinkError: dlopen(/var/folders/sq/rh89_ntd7jqdlv9__25zj9dr0000gp/T/jna--913086793/jna8800789057827590119.tmp, 9): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: image not found
So to fix this I needed to set up a symlink for libjpeg.8.dylib:
ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib
Not sure if there is a way to do this without the symlink (i.e. package it in the jar), but I hope this helps anyone else who is looking at this post.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21394537%2ftess4j-unsatisfied-link-error-on-mac-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
I know it's an old post. I had this problem too recently when I tried to use Tess4J
. However, I managed to find a way around it. I've written a post about it http://www.microshell.com/programming/java/performing-optical-character-recognition-in-java/
In short, the problem is because tess4j-2.0.0.jar
doesn't include MacOS library. So I just modified the maven cached jar on mine by doing these steps:
cd /Users/user/.m2/repository/net/sourceforge/tess4j/tess4j/2.0.0
(adjust the directory where your tess4j JAR file resides)mkdir darwin
jar uf tess4j-2.0.0.jar darwin
cp /opt/local/lib/libtesseract.3.dylib darwin/libtesseract.dylib
jar uf tess4j-2.0.0.jar darwin/libtesseract.dylib
jar tf tess4j-2.0.0.jar
(to verify that the file is included)
I was then able to run my Java program after I modify the tess4j-2.0.0.jar
file. Below is my MacOS version.
user@laptop:~$ uname -a
Darwin Maresas-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
add a comment |
I know it's an old post. I had this problem too recently when I tried to use Tess4J
. However, I managed to find a way around it. I've written a post about it http://www.microshell.com/programming/java/performing-optical-character-recognition-in-java/
In short, the problem is because tess4j-2.0.0.jar
doesn't include MacOS library. So I just modified the maven cached jar on mine by doing these steps:
cd /Users/user/.m2/repository/net/sourceforge/tess4j/tess4j/2.0.0
(adjust the directory where your tess4j JAR file resides)mkdir darwin
jar uf tess4j-2.0.0.jar darwin
cp /opt/local/lib/libtesseract.3.dylib darwin/libtesseract.dylib
jar uf tess4j-2.0.0.jar darwin/libtesseract.dylib
jar tf tess4j-2.0.0.jar
(to verify that the file is included)
I was then able to run my Java program after I modify the tess4j-2.0.0.jar
file. Below is my MacOS version.
user@laptop:~$ uname -a
Darwin Maresas-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
add a comment |
I know it's an old post. I had this problem too recently when I tried to use Tess4J
. However, I managed to find a way around it. I've written a post about it http://www.microshell.com/programming/java/performing-optical-character-recognition-in-java/
In short, the problem is because tess4j-2.0.0.jar
doesn't include MacOS library. So I just modified the maven cached jar on mine by doing these steps:
cd /Users/user/.m2/repository/net/sourceforge/tess4j/tess4j/2.0.0
(adjust the directory where your tess4j JAR file resides)mkdir darwin
jar uf tess4j-2.0.0.jar darwin
cp /opt/local/lib/libtesseract.3.dylib darwin/libtesseract.dylib
jar uf tess4j-2.0.0.jar darwin/libtesseract.dylib
jar tf tess4j-2.0.0.jar
(to verify that the file is included)
I was then able to run my Java program after I modify the tess4j-2.0.0.jar
file. Below is my MacOS version.
user@laptop:~$ uname -a
Darwin Maresas-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
I know it's an old post. I had this problem too recently when I tried to use Tess4J
. However, I managed to find a way around it. I've written a post about it http://www.microshell.com/programming/java/performing-optical-character-recognition-in-java/
In short, the problem is because tess4j-2.0.0.jar
doesn't include MacOS library. So I just modified the maven cached jar on mine by doing these steps:
cd /Users/user/.m2/repository/net/sourceforge/tess4j/tess4j/2.0.0
(adjust the directory where your tess4j JAR file resides)mkdir darwin
jar uf tess4j-2.0.0.jar darwin
cp /opt/local/lib/libtesseract.3.dylib darwin/libtesseract.dylib
jar uf tess4j-2.0.0.jar darwin/libtesseract.dylib
jar tf tess4j-2.0.0.jar
(to verify that the file is included)
I was then able to run my Java program after I modify the tess4j-2.0.0.jar
file. Below is my MacOS version.
user@laptop:~$ uname -a
Darwin Maresas-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
edited Jun 9 '15 at 17:08
answered Jun 9 '15 at 6:49
maresamaresa
401412
401412
add a comment |
add a comment |
You need install the tesseract lib on your Mac.
brew install tesseract --with-all-languages
add a comment |
You need install the tesseract lib on your Mac.
brew install tesseract --with-all-languages
add a comment |
You need install the tesseract lib on your Mac.
brew install tesseract --with-all-languages
You need install the tesseract lib on your Mac.
brew install tesseract --with-all-languages
edited Nov 22 '18 at 11:55
Torbilicious
102113
102113
answered Feb 6 '17 at 17:12
Long NguyenLong Nguyen
1,52011323
1,52011323
add a comment |
add a comment |
I had a very similar issue with Ghost4j, i.e.
InvocationTargetException: Unable to load library 'gs': Native library (darwin/libgs.dylib) not found in resource path
Instead of modifying jar files, point jna to the appropriate lib path by setting jna.library.path
. In Eclipse, you need to set the system property in run configurations - SO answer for this here - https://stackoverflow.com/a/862405/2163229
If you're using Maven exec:
mvn -Djna.library.path=/opt/local/lib/ exec:java -Dexec.mainClass="foo.bar.NativeThingy"
or
export MAVEN_OPTS="-Djna.library.path=/opt/local/lib/" && mvn exec:java -Dexec.mainClass="foo.bar.NativeThingy"
Obviously, set the path to wherever your libs are installed. In my case, I ran $ locate libgs.dylib
and found the above path.
References:
https://jna.java.net/javadoc/com/sun/jna/NativeLibrary.html
add a comment |
I had a very similar issue with Ghost4j, i.e.
InvocationTargetException: Unable to load library 'gs': Native library (darwin/libgs.dylib) not found in resource path
Instead of modifying jar files, point jna to the appropriate lib path by setting jna.library.path
. In Eclipse, you need to set the system property in run configurations - SO answer for this here - https://stackoverflow.com/a/862405/2163229
If you're using Maven exec:
mvn -Djna.library.path=/opt/local/lib/ exec:java -Dexec.mainClass="foo.bar.NativeThingy"
or
export MAVEN_OPTS="-Djna.library.path=/opt/local/lib/" && mvn exec:java -Dexec.mainClass="foo.bar.NativeThingy"
Obviously, set the path to wherever your libs are installed. In my case, I ran $ locate libgs.dylib
and found the above path.
References:
https://jna.java.net/javadoc/com/sun/jna/NativeLibrary.html
add a comment |
I had a very similar issue with Ghost4j, i.e.
InvocationTargetException: Unable to load library 'gs': Native library (darwin/libgs.dylib) not found in resource path
Instead of modifying jar files, point jna to the appropriate lib path by setting jna.library.path
. In Eclipse, you need to set the system property in run configurations - SO answer for this here - https://stackoverflow.com/a/862405/2163229
If you're using Maven exec:
mvn -Djna.library.path=/opt/local/lib/ exec:java -Dexec.mainClass="foo.bar.NativeThingy"
or
export MAVEN_OPTS="-Djna.library.path=/opt/local/lib/" && mvn exec:java -Dexec.mainClass="foo.bar.NativeThingy"
Obviously, set the path to wherever your libs are installed. In my case, I ran $ locate libgs.dylib
and found the above path.
References:
https://jna.java.net/javadoc/com/sun/jna/NativeLibrary.html
I had a very similar issue with Ghost4j, i.e.
InvocationTargetException: Unable to load library 'gs': Native library (darwin/libgs.dylib) not found in resource path
Instead of modifying jar files, point jna to the appropriate lib path by setting jna.library.path
. In Eclipse, you need to set the system property in run configurations - SO answer for this here - https://stackoverflow.com/a/862405/2163229
If you're using Maven exec:
mvn -Djna.library.path=/opt/local/lib/ exec:java -Dexec.mainClass="foo.bar.NativeThingy"
or
export MAVEN_OPTS="-Djna.library.path=/opt/local/lib/" && mvn exec:java -Dexec.mainClass="foo.bar.NativeThingy"
Obviously, set the path to wherever your libs are installed. In my case, I ran $ locate libgs.dylib
and found the above path.
References:
https://jna.java.net/javadoc/com/sun/jna/NativeLibrary.html
edited May 23 '17 at 12:09
Community♦
11
11
answered Apr 10 '16 at 18:14
Michael MiklavcicMichael Miklavcic
7113
7113
add a comment |
add a comment |
Make sure you use libtesseract.dylib
of Tesseract 3.02 version. Check out this post on Tesseract Forum.
I am using version 3.02.02, and i checked that post out before but it does not work. And i also added the java -Djava.library.path as vm argument . Can 64 bit jvm throw this error
– nestrocuation
Jan 28 '14 at 2:55
1
Very possible. Tesseract and Leptonica are 32-bit libraries. Could take quite a bit of work to compile them to 64-bit.
– nguyenq
Jan 28 '14 at 3:14
add a comment |
Make sure you use libtesseract.dylib
of Tesseract 3.02 version. Check out this post on Tesseract Forum.
I am using version 3.02.02, and i checked that post out before but it does not work. And i also added the java -Djava.library.path as vm argument . Can 64 bit jvm throw this error
– nestrocuation
Jan 28 '14 at 2:55
1
Very possible. Tesseract and Leptonica are 32-bit libraries. Could take quite a bit of work to compile them to 64-bit.
– nguyenq
Jan 28 '14 at 3:14
add a comment |
Make sure you use libtesseract.dylib
of Tesseract 3.02 version. Check out this post on Tesseract Forum.
Make sure you use libtesseract.dylib
of Tesseract 3.02 version. Check out this post on Tesseract Forum.
answered Jan 28 '14 at 2:13
nguyenqnguyenq
6,53111013
6,53111013
I am using version 3.02.02, and i checked that post out before but it does not work. And i also added the java -Djava.library.path as vm argument . Can 64 bit jvm throw this error
– nestrocuation
Jan 28 '14 at 2:55
1
Very possible. Tesseract and Leptonica are 32-bit libraries. Could take quite a bit of work to compile them to 64-bit.
– nguyenq
Jan 28 '14 at 3:14
add a comment |
I am using version 3.02.02, and i checked that post out before but it does not work. And i also added the java -Djava.library.path as vm argument . Can 64 bit jvm throw this error
– nestrocuation
Jan 28 '14 at 2:55
1
Very possible. Tesseract and Leptonica are 32-bit libraries. Could take quite a bit of work to compile them to 64-bit.
– nguyenq
Jan 28 '14 at 3:14
I am using version 3.02.02, and i checked that post out before but it does not work. And i also added the java -Djava.library.path as vm argument . Can 64 bit jvm throw this error
– nestrocuation
Jan 28 '14 at 2:55
I am using version 3.02.02, and i checked that post out before but it does not work. And i also added the java -Djava.library.path as vm argument . Can 64 bit jvm throw this error
– nestrocuation
Jan 28 '14 at 2:55
1
1
Very possible. Tesseract and Leptonica are 32-bit libraries. Could take quite a bit of work to compile them to 64-bit.
– nguyenq
Jan 28 '14 at 3:14
Very possible. Tesseract and Leptonica are 32-bit libraries. Could take quite a bit of work to compile them to 64-bit.
– nguyenq
Jan 28 '14 at 3:14
add a comment |
This is exactly what I was after today, so thanks for the Q&A above. As one additional step beyond what maresa mentioned, I ran into this error after fixing the one you asked about:
java.lang.UnsatisfiedLinkError: dlopen(/var/folders/sq/rh89_ntd7jqdlv9__25zj9dr0000gp/T/jna--913086793/jna8800789057827590119.tmp, 9): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: image not found
So to fix this I needed to set up a symlink for libjpeg.8.dylib:
ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib
Not sure if there is a way to do this without the symlink (i.e. package it in the jar), but I hope this helps anyone else who is looking at this post.
add a comment |
This is exactly what I was after today, so thanks for the Q&A above. As one additional step beyond what maresa mentioned, I ran into this error after fixing the one you asked about:
java.lang.UnsatisfiedLinkError: dlopen(/var/folders/sq/rh89_ntd7jqdlv9__25zj9dr0000gp/T/jna--913086793/jna8800789057827590119.tmp, 9): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: image not found
So to fix this I needed to set up a symlink for libjpeg.8.dylib:
ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib
Not sure if there is a way to do this without the symlink (i.e. package it in the jar), but I hope this helps anyone else who is looking at this post.
add a comment |
This is exactly what I was after today, so thanks for the Q&A above. As one additional step beyond what maresa mentioned, I ran into this error after fixing the one you asked about:
java.lang.UnsatisfiedLinkError: dlopen(/var/folders/sq/rh89_ntd7jqdlv9__25zj9dr0000gp/T/jna--913086793/jna8800789057827590119.tmp, 9): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: image not found
So to fix this I needed to set up a symlink for libjpeg.8.dylib:
ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib
Not sure if there is a way to do this without the symlink (i.e. package it in the jar), but I hope this helps anyone else who is looking at this post.
This is exactly what I was after today, so thanks for the Q&A above. As one additional step beyond what maresa mentioned, I ran into this error after fixing the one you asked about:
java.lang.UnsatisfiedLinkError: dlopen(/var/folders/sq/rh89_ntd7jqdlv9__25zj9dr0000gp/T/jna--913086793/jna8800789057827590119.tmp, 9): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: image not found
So to fix this I needed to set up a symlink for libjpeg.8.dylib:
ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib
Not sure if there is a way to do this without the symlink (i.e. package it in the jar), but I hope this helps anyone else who is looking at this post.
answered Aug 5 '15 at 22:51
Andrew NeilsonAndrew Neilson
14816
14816
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21394537%2ftess4j-unsatisfied-link-error-on-mac-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown