I'm wanting to make a voice controlled program,
But when I type: 'import javax.speech' into NetBeans it says that
'javax.speech' doesn't exist.

I then downloaded Free TTS, copied the speech.properties like
I was supposed to. It still is showing the error. I did some more
research and found a place that told me to use WinZip on the jsapi.jar
file. I did.

It is still showing the error. I don't know where to put the javax
folder I now have. I tried putting it in the 'lib' folder of my 'jre6' folder.
I have also heard of Sphinx4 for this, any advice?

Anyone who could help me in this area I would be very grateful to them!!

Thanks,
-WolfShield

You should not have to unzip the jar. Have you added it to the Compile libraries in your Project Properties > Libraries tab?

Wow,
Amazing how such a vast and seemingly hopeless problem can
have such a simple, ten second solution.

Thank you very much!

Now, almost all of the errors are gone, only one has stayed behind.

Here is the code:

import javax.speech.*;
import javax.speech.synthesis.*;
import java.util.Locale;

public class Speech {
	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();
		}
	}
}

On line 1 NetBeans says 'Incorrect Package'. But all of the other errors
are gone!

Any idea what I can do to fix this?

And thanks again for the great advice!!!
It helped me exponentially!

-WolfShield

The package declaration needs to match the directory structure of classes.

If you had a base directory called src , a class in a child directory src/ui , you would need a package declaration package ui; . A class in src/ui/main would be declare package ui.main; So depending on the directory structure of your source code base, you may need to add or adjust the package declarations.

Thanks!!
You have been very, very helpful!!!

Thanks a million!

-WolfShield

package does not exist in my case. I have done the above resolution still it says does not exist.

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.