I emailed Tyler Streeter, the creator of Voce and he helped me solve this problem.
Basically, the voce.SpeechInterface.init()
is actually looking for a File URL and not a String as such.
So, here is how to make the code work :
try {
grammarPath = new File("\\Path\\To\\grammar\\").toURI().toURL().toString();
} catch (Exception e) {
help.setText("" + e);
}
voce.SpeechInterface.init("./lib", true, true, grammarPath, "digits");