Question

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.

Was it helpful?

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.

OTHER TIPS

I see that you are using Ubuntu. You must agree to the binary license before you can use jsapi.jar. You agree to this license in the process of unpacking it. To unpack jsapi.jar in Ubuntu you would type the following:

cd ~/Desktop/freetts-1.2/lib
chmod +x ./jsapi.sh
./jsapi.sh 

if you receive a message like

"./jsapi.sh: 1428: uudecode: not found"

then install uudecode with

sudo apt-get install sharutils

and try again

I got this error despite I had jsapi.jar on classpath.

java -cp `ls *.jar | awk '{ORS=":";print}'` -jar WebStartClock.jar

What helped me was specifying the main class explicitely:

java -cp `ls *.jar | awk '{ORS=":";print}'` JSAPIClock

Probably something wrong in the JAR metadata or so.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top