Engine.Load "未指定的错误"

  • 19 Views
  • Last Post 2 weeks ago
王德海 posted this 2 weeks ago

This is result of  running  the   "Hello (Java)" Samples

I reset java env, make and run .....I do not know where is wrong

Order By: Standard | Newest | Votes
王德海 posted this 2 weeks ago

// 2015 ABBYY Production LLC. 

// ABBYY, FLEXICAPTURE and FLEXILAYOUT are either registered trademarks or trademarks of ABBYY Software Ltd.

// SAMPLES code is property of ABBYY, exclusive rights are reserved. 

// DEVELOPER is allowed to incorporate SAMPLES into his own APPLICATION and modify it 

// under the terms of License Agreement between ABBYY and DEVELOPER.

 

import com.abbyy.FCEngine.*;

 

public class Hello {

 

public static void main( String[] args ) 

{

try {

trace( "Load the engine..." );

//System.out.println("serialNumber:"+serialNumber+",dllPath:"+dllPath);

 

IEngine engine = Engine.Load( dllPath, serialNumber, "" );

 

try{

 

trace( "Create and configure FlexiCaptureProcessor..." );

IFlexiCaptureProcessor processor = engine.CreateFlexiCaptureProcessor();

processor.AddDocumentDefinitionFile( samplesFolder + "SampleProject\\Templates\\Invoice_eng.fcdot" );

 

trace( "Add image files to recognize..." );

processor.AddImageFile( samplesFolder + "SampleImages\\Invoices_1.tif" );

 

trace( "Recognize document..." );

IDocument document = processor.RecognizeNextDocument();

IDocumentDefinition definition = document.getDocumentDefinition();

assert( definition != null );

assert( document.getPages().getCount() == 1 );

 

trace( "====================================" );

trace( "DocumentType: " + document.getDocumentDefinition().getName() );

trace( "====================================" );

IFields fields = document.getSections().Item( 0 ).getChildren();

for( int i = 0; i < fields.getCount(); i++ ) {

IField field = fields.getElement( i );

trace( field.getName() + ": " +

( field.getValue() != null ? field.getValue().getAsString() : "." ) );

}

trace( "====================================" );

 

} finally {

Engine.Unload();

}

 

trace( "Done." );

} catch( Exception ex ) {

trace( ex.getMessage() );

}

}

 

private static void trace( String txt ) 

{

System.out.println( txt );

}

 

static private String samplesFolder;

static private String serialNumber;

static private String dllPath;

static {

samplesFolder = "C:\\ProgramData\\ABBYY\\SDK\\11\\FlexiCapture Engine\\Samples\\";

try {

java.io.FileInputStream file = new java.io.FileInputStream( samplesFolder + "SampleConfig\\SamplesConfig.txt" );

java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader( file ) );

serialNumber = reader.readLine();

 

 

dllPath = reader.readLine();

 

file.close();

} catch( java.io.IOException e ) {

    System.out.println( e.getMessage() );

}

}

}

 

Oksana Serdyuk posted this 2 weeks ago

Hi, could you please check the following post and try the solution described here: Hello.java sample code provided by ABBYY Flexi Capture 11 R2 is giving unspecified error?

Please let us know about the result.

Close