From: <php...@li...> - 2007-07-13 22:51:17
|
Hello, i'm running into a little problem when i want to use a *.jar which requires a shared object. i registered the object and when i list all the registred objects with ldconfig it's there but when i run my code i get this: CreateInstance failed: new com.asprise.util.ocr.OCR. Cause: java.lang.UnsatisfiedLinkError: Native library AspriseOCR could not be found in java_require() path. anybody who knows how to do the trick? -- Gilbert Groenendijk |
From: <php...@li...> - 2007-07-14 16:24:32
|
Hi, [loading impure java libraries] > anybody who knows how to do the trick? The native part should go into a VM specific library dir and the Java part into java.ext.dirs. <?php echo java("java.lang.System")->getProperties(); ?> should show the location of both directories. Regards, Jost Boekemeier __________________________________ Die etwas anderen Infos rund um das Thema Reisen. BE A BETTER WELTENBUMMLER! www.yahoo.de/clever |
From: <php...@li...> - 2007-07-14 19:34:23
|
Hi Jost, Thank you for your anwser.I tried your suggestion and it didn't gave me that error but i still don't get it to work. It just says: Cause: java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError. This is what i did: moved libAspriseOCR.so to /usr/lib/jvm/java-1_4_2-sun-1.4.2.13 /jre/lib/i386/client/libAspriseOCR.so moved aspriseOCR.jar to /usr/lib/jvm/java-1_4_2-sun-1.4.2.13 /jre/lib/ext/aspriseOCR.jar restarted tomcat and apache See my code below, Java code is directly copied from the manufactures website: /* The original java code: import com.asprise.util.pdf.PDFReader; import com.asprise.util.ocr.OCR; PDFReader reader = new PDFReader(new File("my.pdf")); reader.open(); // open the file. int pages = reader.getNumberOfPages(); for(int i=0; i < pages; i++) { BufferedImage img = reader.getPageAsImage(i); // recognizes both characters and barcodes String text = new OCR().recognizeAll(image); System.out.println("Page " + i + ": " + text); } reader.close(); // finally, close the file. */ // My php5 Code $aJarFiles[] = "./external/lucene-demos-2.0.0.jar"; $aJarFiles[] = "./external/lucene-core-2.0.0.jar"; $aJarFiles[] = "./external/junit.jar"; $aJarFiles[] = "./external/checkstyle-all-4.2.jar"; $aJarFiles[] = "./external/bcprov-jdk14-132.jar"; $aJarFiles[] = "./external/bcmail-jdk14-132.jar"; $aJarFiles[] = "./external/ant.jar"; $aJarFiles[] = "./external/FontBox-0.1.0-dev.jar"; $aJarFiles[] = "./AspriseJavaPDF.jar"; $aJarFiles[] = "./aspriseOCR.jar"; java_require(implode(";",$aJarFiles)); $file = new Java('java.io.File',"./changes.pdf"); $reader = new Java('com.asprise.util.pdf.PDFReader',$file); $reader->open(); $pages = $reader->getNumberOfPages(); for($i=0; $i < $pages; $i++) { $img = $reader->getPageAsImage($i); $ocr = new Java('com.asprise.util.ocr.OCR'); $text = $ocr->recognizeAll($img); print $text; } Any idea what's wrong with my setup? i Put everything in a zip if you would like to take a look: http://infolook.mpublisher.com/ocr.zip On 7/14/07, php...@li... < php...@li...> wrote: > > Hi, > > [loading impure java libraries] > > > anybody who knows how to do the trick? > > The native part should go into a VM specific library > dir and the Java part into java.ext.dirs. > > <?php > echo java("java.lang.System")->getProperties(); > ?> > > should show the location of both directories. > > > Regards, > Jost Boekemeier > > > > > __________________________________ Die etwas anderen Infos rund um > das Thema Reisen. BE A BETTER WELTENBUMMLER! www.yahoo.de/clever > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > -- Gilbert Groenendijk |
From: <php...@li...> - 2007-07-16 15:35:38
|
Hi, > It just says: > Cause: java.lang.ClassNotFoundException: Unresolved external reference: > java.lang.NoClassDefFoundError. then you're out of luck. Java doesn't have a proper module system, the above error means that you have compiled against a different API and than what is available now. When you get the above exception without any indication which class or package is missing, you can't proceed. The only way to solve the above Java error is to step back and read the documentation of the Java package, which should list the external package dependencies and their versions. Regards, Jost Boekemeier __________________________________ Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: http://de.yahoo.com/set |