Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bad Class File Error... What am i doing wrong?

843810Sep 27 2002 — edited Dec 30 2002
Hi,

I am trying to run a 'Hello World' program which came with the FreeTTS package from links from the java.sun.com website, and am not able to compile the program. I get the error:

FreeTTSHelloWorld.java:4: cannot access
cl.com.sun.speech.freetts.audio.Voice
bad class file: .\cl\com\sun\speech\freetts\audio\Voice.class
class file contains wrong class: com.sun.speech.freetts.Voice
Please remove or make sure it appears in the correct subdirectory of the classpath.
import cl.com.sun.speech.freetts.audio.Voice;
_______________________________________^

The FreeTTSHelloWorld.java File is printed below [its embarassingly simple..]

/**
* Copyright 2001 Sun Microsystems, Inc.
**/
import cl.com.sun.speech.freetts.audio.Voice;
import cl.com.sun.speech.freetts.audio.JavaClipAudioPlayer;
import cl.com.sun.speech.freetts.en.us.CMULexicon;

public class FreeTTSHelloWorld {
public static void main(String[] args) {
try {
String voiceClassName = (args.length > 0) ? args[0] :
"com.sun.speech.freetts.en.us.CMUDiphoneVoice";

Class voiceClass = Class.forName(voiceClassName);

Voice helloVoice = (Voice) voiceClass.newInstance();

helloVoice.setLexicon(new CMULexicon());

helloVoice.setAudioPlayer(new JavaClipAudioPlayer());

helloVoice.load();

helloVoice.speak
("Thank you for giving me a voice. I'm so glad to say
hello to this world.");

System.exit(0);
}
catch (Exception e) {
e.printStackTrace();
}
}
}


I've tried a billion things, including moving around the .class files [which, by the way, i extracted myself from the .jar files which came with the FreeTTS package - is that what i'm doing wrong? if so, please tell me - ] and still nothing happens - the same error results.

I've tried reading other cases similar to mine in the forums, but most of the things i read didn't apply to my (quite simple) situation, such as the 'package' line needing to be removed or anything like that..

I run Win2k and have j2sdk1.4.0_01 installed on my machine

I beg for anyone's help. Thanks in advance
-=Miagi=-
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 27 2003
Added on Sep 27 2002
7 comments
4,934 views