I wanted to convert text in a JTextArea into voice but I seem to keep getting an error at the same line.
Voice voice;
VoiceManager vm = VoiceManager.getInstance();
voice = vm.getVoice(VOICENAME);
voice.allocate();
try{
voice.speak(voice_txt.getText());
}
catch (Exception e){
JOptionPane.showMessageDialog(rootPane, e);}
This is the error I keep getting
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at FrameTextToSpeech.jButton1ActionPerformed(FrameTextToSpeech.java:75)
The error points to this line
voice.allocate();