java - Error: Main method not found in class... why am I getting this? -
before people start flagging question duplicate, know took time @ similar questions, , found answers other "error: main method not found in class..." not applicable situation (according limited understanding of java)
i'm trying utilize text speech api. eclipse isn't complaining following code until try compile:
package com.texttospeech; import com.sun.speech.freetts.voice; import com.sun.speech.freetts.voicemanager; public class freetts { private static final string voicename_kevin = "kevin"; private string text; // string speech public freetts(string text) { this.text = text; } public void speak() { voice voice; voicemanager voicemanager = voicemanager.getinstance(); voice = voicemanager.getvoice(voicename_kevin); voice.allocate(); voice.speak(text); } public static void main(string[] args) { string text = "freetts written sun microsystems laboratories " + "speech team , based on cmu's flite engine."; freetts freetts = new freetts(text); freetts.speak(); } }
the following error shows in console:
error: main method not found in class com.texttospeech.freetts, please define main method as: public static void main(string[] args)
the code above has main method, know why getting error, , furthermore how can fix it?
i think has name of class. if change name of class t2s , try compile, error:
error: not find or load main class com.texttospeech.t2s
anybody have thoughts? appreciated.
you may have messed project properties. don't use eclipse, cannot sure, try creating new project , adding same code without fiddling properties. class name , file name should same, check that. make sure source file in same package folder. if nothing works, create new project.
cheers.
Comments
Post a Comment