JSAPI - "Hello World!" example-NullPointerExcepiton
807580May 24 2010 — edited May 25 2010Hi everyone,
I m trying to run this example and I always get the following exception: java.lang.NullPointerException
at HelloWorld.main(HelloWorld.java:38)
The example is at : http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-guide/Recognition.html#15438
....
public static void main(String args[]) {
try {
// Create a recognizer that supports English.
rec = Central.createRecognizer(
new EngineModeDesc(Locale.ENGLISH));
// Get the list of matching engine modes
EngineList list = Central.availableSynthesizers(null);
System.out.println("return value is :"+list.isEmpty());
// Start up the recognizer
rec.allocate();
....
} catch (Exception e) {
e.printStackTrace();
}
}
....
I know that the problem is at line "rec.allocate()". As you can see, I m checking if there are not any engines available on my pc and the return value is TRUE, which means there are no engines. I know that this is the problem but I don't know how to fix it .I m trying to find out how to fix that problem a few days now. I searched a lot in google and many forums , where I found that many people had the same problem but without giving any solution. Everyone say that the problem is that no engine is available on the pc.
Can anybody give me a hand, please?