0

I got this result and I can't explain.

Exception in thread "main" java.lang.VerifyError: (class: javax/speech/Central, method: createRecognizer signature: (Ljavax/speech/EngineModeDesc;)Ljavax/speech/recognition/Recognizer;) Incompatible object argument for function call
at enad.trainings.Hello.main(Hello.java:31)

Line 31 is:

Synthesizer synth = Central.createSynthesizer(new SynthesizerModeDesc(Locale.ENGLISH));

I tried to search on google but it was not enough.

I wonder why the message error is about "Recognizer" while I'm using "Synthesizer".

enad.trainings is a package that I created to test my code.

I'm working on Eclipse.

There is my code : package enad.trainings;

import java.util.Locale;

import javax.speech.Central;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;


public class Hello {


public static void main(String[] args) {

    try {
        // Create a synthesizer for English
        // Synthesizer synth = Central.createSynthesizer(new
        // SynthesizerModeDesc(Locale.ENGLISH));
        Synthesizer synth = Central.createSynthesizer(new   SynthesizerModeDesc(Locale.ENGLISH));

        // Get it ready to speak
        synth.allocate();
        synth.resume();

        // Speak the "Hello World" string
        synth.speak("Hello, world!", null);
        // Wait till speaking is done
        synth.waitEngineState(Synthesizer.QUEUE_EMPTY);

        // Clean up
        synth.deallocate();
    } catch (Exception e) {
        e.printStackTrace();
    }

}

}
Necto
  • 2,594
  • 1
  • 20
  • 45
Fan Jups
  • 14
  • 4
  • Either you are using a code in a bigger version of the library or you are using a code in a lower version of the library, whatever it is. – Jorge Campos Jul 03 '16 at 16:17
  • See [Reasons of getting a java.lang.VerifyError](http://stackoverflow.com/a/2518002/6505250) – howlger Jul 03 '16 at 22:22
  • Thanks, I solved the problem. I installed FREETTS again because the first time I failed how to install correctly . The following websites help me :) http://www.rgagnon.com/javadetails/java-use-java-speech-api.html http://www.ryan-h.com/uncategorized/java-speech-jsapi-freetts/ http://docs.oracle.com/cd/E17802_01/products/products/java-media/speech/forDevelopers/jsapi-doc/javax/speech/package-summary.html http://freetts.sourceforge.net/javadoc/com/sun/speech/freetts/VoiceManager.html#getVoices http://freetts.sourceforge.net/docs/index.php#download_and_install – Fan Jups Jul 04 '16 at 11:33

0 Answers0