4 Replies Latest reply: Dec 29, 2011 9:17 PM by 908125 RSS

    Java Speech Synthesizer problem

      I am new to the Java Speech API but have learned a bit from the Internet so am just kick starting into the Speech Synthesis Application Development

      Let me Describe what i have done so far.

      Since oracle doesn't provide java speech api in built with the SE i have downloaded the FreeTTS implementation of the Speech Api

      Running the jsapi.exe gives a jar file which i have copied the following jars "jsapi.jar, freetts.jar, cmu_time_awb.jar, cmu_us_kal.jar"
      C:\Program Files\Java\jdk1.6.0_22\jre\lib\ext 
      this folder

      and somewhere on the net it was instructed that i need to copy the speech.properties file

      C:\Program Files\Java\jdk1.6.0_22\jre\lib
      when i try to execute the following example program
      import javax.speech.*;
      import javax.speech.synthesis.*;
      import java.util.Locale;
      public class HelloWorld {
           public static void main(String args[]) {
                try {
                     // Create a synthesizer for English
                     Synthesizer synth = Central.createSynthesizer(
                          new SynthesizerModeDesc(Locale.ENGLISH));
                     // Get it ready to speak
                     // Speak the "Hello world" string
                     synth.speakPlainText("Hello, world!", null);
                     // Wait till speaking is done
                     // Clean up
                } catch (Exception e) {

      But during running it gives the following error
      Exception in thread "main" java.lang.NoClassDefFoundError: javax/speech/EngineMo
      Caused by: java.lang.ClassNotFoundException: javax.speech.EngineModeDesc
              at java.net.URLClassLoader$1.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
      Could not find the main class: HelloWorld.  Program will exit.
      I don't know what is the problem. may be with the path or something

      Please help me out its really urgent :(( thanks in advance