Boa noite,
Alguém sabe como resolver o erro java.lang.NullPointerException
quando é executada a o método synth.allocate();
estou com esse problema e não tenho ideia do que fazer para resolver.
O meu código fonte é o seguinte:
[code]import javax.speech.;
import javax.speech.synthesis.;
import java.util.Locale;
/**
*
-
@author axsd
*/
public class Teste {/**
-
@param args the command line arguments
*/
public static void main(String[] args) {
try {
// Create a synthesizer for English
Synthesizer synth = Central.createSynthesizer(
new SynthesizerModeDesc(Locale.US));// Get it ready to speak synth.allocate(); synth.resume(); // Speak the "Hello world" string synth.speakPlainText("Hello, world!", null); // Wait till speaking is done synth.waitEngineState(Synthesizer.QUEUE_EMPTY); // Clean up synth.deallocate();
} catch (Exception e) {
e.printStackTrace();
}
}
}[/code]
-
Obrigado