开发者

Having Problems Getting FreeTTS and JSAPI Working

开发者 https://www.devze.com 2022-12-30 18:21 出处:网络
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)

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 g开发者_如何学运维etting it to work but not many that discuss their solution.


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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号