Search code examples
javajsapifreetts

Having Problems Getting FreeTTS and JSAPI Working


First off I'm on Ubuntu linux if that matters.
I have a simple project idea based off of FreeTTS and the JSAPI (Java Speech API)

I've downloaded and unpacked FreeTTS and run their build script. Then tried compiling my code linking several jar's required in the lib directory into the class path like this:

javac -cp /home/travis/Desktop/freetts-1.2/lib/jsapi.jar:/home/travis/Desktop/freetts-1.2/lib/freetts.jar HelloUnleashedReader.java

Which then compiles to java bytecode just fine. However when I run:

java HelloUnleashedReader

I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/speech/EngineModeDesc

Any help on this issue would be greatly appreciated as there are many sites around the net discussing problems with getting it to work but not many that discuss their solution.


Solution

  • You need to add the jsapi.jar into your classpath. The jsapi.jar can be unpacked by running lib/jsapi.exe inside the freetts installation directory.