2

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Swapnil B
  • 79
  • 1
  • 8

2 Answers2

1

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.

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
0

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

lschuetze
  • 1,218
  • 10
  • 25
  • 1
    Hey! How can I add the jar file so that not just one project but the availability is extended to all programs in a way similar to the availability of jdk. In other words I want to add the java speech to the jdk directory and add classpath – Swapnil B Jan 08 '17 at 12:01
  • Well, 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/` where `~/the/path` would be where you stored the jar. Then, you have to add the environment variable `$JS_API_HOME` to every build/classpath where you want to use the library. – lschuetze Jan 08 '17 at 12:25
  • I deleted all the zip files and re downloaded freeTTS bin from https://sourceforge.net/projects/freetts/files/FreeTTS/FreeTTS%201.2.2/ – Swapnil B Jan 08 '17 at 13:43
  • I deleted all the zip files and re downloaded freeTTS bin from https://sourceforge.net/projects/freetts/files/FreeTTS/FreeTTS%201.2.2/ and I read the readme.txt and proceeded accordingly. Typed chmod -X ./jsapi.sh. next i typed sh ./jsapi.sh. Typed y to get the error: sed: no such .file or directory – Swapnil B Jan 08 '17 at 14:09
  • You should reconsider to update your question as you did not stated that there is a real install script. From your current question I just thought about jars being deployed. – lschuetze Jan 08 '17 at 15:30
  • I actually downloaded and extracted the software now myself. Updated my answer accordingly. – lschuetze Jan 08 '17 at 15:53
  • I did as you said and extracted the jar.However javac compiler is giving javax.speech.recognition deosnt exist errorfor a code i copied fromhttps://www.daniweb.com/programming/software-development/threads/298652/java-speech-api – Swapnil B Jan 09 '17 at 10:15