|
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
|