Hi ,


I have speech synthesizer java program. It is running fine when i run it from netbeans.

But when i build the project and run the jar file , it's not working.

The entire program is running fine in the jar file (i.e displaying window , doing stuff etc) but the speech synthesizer part only is not working .

There are no errors when i run it in netbeans . The speech synthesizer part is also working. But when i run the jar file , the part is not working . Why is it so ?

What's going wrong?

Thanks in advance..

Do you have any exceptions thrown? Do 100% of your catch blocks printStackTrace()?

Are there any error messages when you execute the jar file?
To see the error messages, open a command prompt, change to the folder with the jar file and enter:
java -jar <THEJARFILENAME>.jar

Copy the contents of the command prompt window and paste here. If on Windows:
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

System property "mbrola.base" is undefined.  Will not use MBROLA voices.
Exception in thread "main" java.lang.NullPointerException
        at Main.main(Main.java:76)

Strange. Why there is no error when i run the same code from netbeans. The program runs absolutely fine from netbeans.

Looks like a problem accessing system properties???

System property "mbrola.base" is undefined.  Will not use MBROLA voices.

That line . Even i got in netbeans. But the NullpointerException not occured when i run in netbeans. It worked fine and i got the output .

System property "mbrola.base" is undefined. Will not use MBROLA voices.

I guess it is not a error. It is just saying that it will not use that mbrola voice. It is using default voice.

But that nullpointerexception is causing the jar file to quit which is not happening when i run from netbeans

I wanted to run my application in system startup . So i attempted to make the jar file .
So that there will not be command prompt window popping.
Other than that i had no problem running in the IDE.

What's on the line where you get the NPE (76)?

The code on the line 76 is

JOptionPane.showMessageDialog(null,"Application Started........Activated to Listening Mode");

But it is not the one Which is causing NPE i think..

Which line is the one causing the NPE?

System property "mbrola.base" is undefined.  Will not use MBROLA voices.
Exception in thread "main" java.lang.NullPointerException
        at Main.main(Main.java:76)

Strange. Why there is no error when i run the same code from netbeans. The program runs absolutely fine from netbeans.

Check this:http://www.java-forums.org/advanced-java/37345-problem-mbrola-base.html and this:http://stackoverflow.com/questions/3976152/troubleshooting-system-property-mbrola-base-is-undefined-will-not-use-mbrola and also this:http://stackoverflow.com/questions/2486985/freetts-problem-in-java I myself had the problem and i fixed it, however it would still show that error everytime i ran it something to do with mbrola not being nicely compatible with windows, but i have put two links that show you how to get mbrola working-i think- and also a link how to 'bypass' it. thats the first link.

Check this:http://www.java-forums.org/advanced-java/37345-problem-mbrola-base.html and this:http://stackoverflow.com/questions/3976152/troubleshooting-system-property-mbrola-base-is-undefined-will-not-use-mbrola and also this:http://stackoverflow.com/questions/2486985/freetts-problem-in-java I myself had the problem and i fixed it, however it would still show that error everytime i ran it something to do with mbrola not being nicely compatible with windows, but i have put two links that show you how to get mbrola working-i think- and also a link how to 'bypass' it. thats the first link.

I found the exact link that helped me solve the problem, however it didnt allow me to use the mbrola voices check here:http://www.java-forums.org/advanced-java/30495-java-speech-synthesizer.html

Thank you so much for the links.

I am able to use default "kevin16" voice. It works when i run from netbeans. But when i make the jar file and run it , its not working.
It says NullPointerException.
But there is no NPE when i run from the Netbeans IDE. This is my main problem.

However , even i am also brain storming about mbrola voices.

Did you tried running the "kevin16" voice from the jar file? Did it worked for you? Plz let me know.

[EDIT}-

When i run the jar file from command prompt , here's the output

All voices available:
System property "mbrola.base" is undefined.  Will not use MBROLA voices.

Using voice: kevin16
System property "mbrola.base" is undefined.  Will not use MBROLA voices.
Cannot find a voice named kevin16.  Please specify a different voice.

Thank you so much for the links.

I am able to use default "kevin16" voice. It works when i run from netbeans. But when i make the jar file and run it , its not working.
It says NullPointerException.
But there is no NPE when i run from the Netbeans IDE. This is my main problem.

However , even i am also brain storming about mbrola voices.

Did you tried running the "kevin16" voice from the jar file? Did it worked for you? Plz let me know.

[EDIT}-

When i run the jar file from command prompt , here's the output

All voices available:
System property "mbrola.base" is undefined.  Will not use MBROLA voices.

Using voice: kevin16
System property "mbrola.base" is undefined.  Will not use MBROLA voices.
Cannot find a voice named kevin16.  Please specify a different voice.

Yes i was able to use the voice from both netbeans and a jar file however when i ran it from the jar file i would get the first error message, but not the second kevin16 doesnt exist? Did you copy all of the freetts libraries to your jdk path and check if netbeans is picking it up as a package, here is the link i used to setup everything and it all seemed to work? also copy the mbrola jar with the other libraries etc:http://www.ryan-h.com/uncategorized/java-speech-jsapi-freetts/

please also note i have copied the libraries to two different locations: C:\Program Files\Java\jdk1.7.0_02\jre\lib\ext and C:\Program Files\Java\jre7\lib\ext, also i now got rid of the mbrola message i just took out the mbrola jar from both paths :D, but first get it working correctly before you try get rid of the mbrola error message...

Here is the example im using and it works from nb and the jar/command line:

import com.sun.speech.freetts.VoiceManager;

public class test1 {

    public static void main(String[] argv) {

        String voiceName = "kevin16"; // the only usable general purpose voice
        VoiceManager voiceManager = VoiceManager.getInstance();
        com.sun.speech.freetts.Voice voice = voiceManager.getVoice(voiceName);
        voice.allocate();
        voice.speak("hello sir.");
        voice.speak("how are you today");
        voice.speak("Im corrupt");
        voice.deallocate();
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.