java.lang.NoClassDefFoundError

Hello

I am trying to implement functionality for OCR text recognition in URCap. I am using Tesseract ver. 3.4.8. I’ve added tess4j-3.4.8.jar file in resources folder and then in Project properties -> Java Build Path -> Libraries I’ve added it as external JAR.

In pom.xml file I’ve added:

< dependency >
< groupId > net.sourceforge.tess4j< /groupId >
< artifactId >tess4j < /artifactId >
< version > 3.4.8 < /versio n>
< /dependency >

and

< Import-Package >
com.ur.urcap.api*,
sun.misc.*;resolution:=optional,
!net.sourceforge.tess4j,
*
< /Import-Package >

When i deploy my URCap on usrsim and try to run it I get the following error:
java.lang.NoClassDefFoundError: net/sourceforge/tess4j/Tesseract

If net.sourceforge.tess4j is not added in Import-Package or is added without ! when I deploy the UrCap on ursim, in Settings -> System -> URCaps my URCap is with yellow exclamation mark.

Can somebody tell me where I’m wrong. I am .NET developer and Java is new for me.

Hi @ivan.kalachev,

Welcome to the UR community!

Please also add the <Embed-Dependency> tag to your pom.xml file as described here:

Best regards
Ebbe