demande aide pour application HelloWorld par Javax.speech
bonsoir,
j'ai trouvé ce code de l'application helloWorld en utilisant le java speech à travers la bibliothèque javax.speech
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| 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
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();
}
}
} |
lors d'éxécution du programme il m'afficher cette erreur
run:
java.lang.NullPointerException
at HelloWorld.main(HelloWorld.java:11)
BUILD SUCCESSFUL (total time: 3 seconds)
j'ai pas compris la cause si vous pouvez m'aider S.V.P