Null pointer when trying to initialise speech recognition
Hi all,
I am attempting to utilise the JSAPI for a project for display at my Uni that utilises freeTTS and also some Java speech recognition. Through the tutorials online (such as the Hello World) I have built my speech recognizer but as I try to allocate() for the speech recogniser the program gives me a null pointer.
The grammar file that I load into the file reader exists and I do not get a file not found exception. Can anyone see a blindingly obvious error that I am missing?
Code below. The rec.allocate() (third line after the try... is where i am getting my null pointer from.
Cheers
Mark
public BigEars(SpeakEasy gui){
mainGui = gui;
try{
EngineModeDesc desk =new EngineModeDesc(Locale.ENGLISH);
rec = Central.createRecognizer(desk);
rec.allocate();
FileReader reader =new FileReader("speechRecog/grammar.txt");
RuleGrammar rules = rec.loadJSGF(reader);
rules.setEnabled(true);
rec.addResultListener(this);
rec.commitChanges();
rec.requestFocus();
rec.resume();
}
catch (Exception e){
message("There is a problem with this code.");
e.printStackTrace();
}
}

