Click here to Skip to main content
15,905,616 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Java
class mmm
{

    public static String myDir = "c:/temp/";
    public static void main(String[] args)
    {
        // Set the paths
        String imagePath = "me.png";
        String resourcesFolderPath = "./resources/resources";
        OcrEngine ocr = new OcrEngine();
        ocr.setResource(new FolderStream(resourcesFolderPath));
        ocr.getConfig().setNeedRotationCorrection(false);
        ocr.setImage(ImageStream.fromFile(imagePath));
        ILanguage language = Language.load("english");
        ocr.getLanguages().addLanguage(language);
        try {
            if (ocr.process()) {
            	System.out.println("\ranswer -> " + ocr.getText());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

in this above code error
"java.lang.NullPointerException
	at com.aspose.internal.ocr.bj.c.a(Unknown Source)
	at com.aspose.ocr.OcrEngine.a(Unknown Source)
	at com.aspose.ocr.OcrEngine.process(Unknown Source)
	at testing1.mmm.main(mmm.java:36)"


how can i solve tis error
Posted
Updated 10-Oct-13 21:16pm
v3
Comments
Richard MacCutchan 11-Oct-13 3:18am    
Study Java and learn how to check the results of method calls, and not to assume that they will always succeed. Which line of the above code snippet is line 36?
baliram bhande 11-Oct-13 4:48am    
i study java little bit but that error is not in java
Richard MacCutchan 11-Oct-13 5:09am    
That is a standard error in all languages. You have a reference object that does not point to anything: a NULL pointer. Look at the line where it occurred and that should identify the bad reference item.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900