How do I install and set up Java speech (jsapi) for my iMac running the latest OS Sierra?

828 views Asked by At

I am relatively new to Apple OS and thus am not able to figure out as to how do I download, install then set up Java speech jar files and set up the classpath.

I tried everything possible from

  1. Downloading FreeTTS,jsapi and trying to add the jsapi.jar to /library/extensions folder
  2. Trying to use chmod command
  3. Trying to open the jar file (which returned an error and asked me to check console)
  4. Tutorials asking me to drop jar into the "lib" folder (I can't really figure out what and where is the "lib" folder in mac)

Basically I want to use all the capabilities of javax.speech in my Java programs.

2

There are 2 answers

7
lschuetze On

Download FreeTTS. Extract. Open the extracted /lib folder. chmod +x ./jsapi.sh and afterwards sh ./jsapi. Read the BCEL and accept.

Accept (y/n)?: 
y
sed: --print-text-domain-dir: No such file or directory
x - creating lock directory
x - extracting jsapi.jar (binary)

As you can see there is the jsapi.jarbeing extracted into the lib folder (which was not there before). Now you can add the lib folder (it says it will be enough to point to the lib/freetts.jar) to your class path of any application that is using FreeTTS.

You could add it into some directory in your userspace folder and add to your ~/.bash_profile the line export JS_API_HOME=~/the/path/lib where ~/the/path would be where you stored the extracted archive. Then, you have to add the environment variable $JS_API_HOME to every build/classpath where you want to use the library.

For example, java -cp $JS_API_HOME -jar moep.jar

0
Nikolay Shmyrev On

JSAPI is pretty much abandoned, you won't be able to get lot from it. If you want text-to-speech use OpenMary directly without JSAPI, it provides a good selection of modern voices.