1

谢谢您阅读此篇。

我正在使用 freetts 让我的程序说出一些文字......在 IDE 中,当我运行所有程序时,它们工作正常。(我的和所有 freetts 示例程序)。

还有freetts的bin下载附带的可运行程序(jar),可以在终端上正常运行.... Freetts --> http://sourceforge.net/projects/freetts/files/

好吧,当我从 IDE 导出它们时,完全相同的程序不起作用。尝试了 netbeans 和 eclipse 来导出程序,但我得到了错误。

我怀疑它与我在项目中包含的 jar 文件(jsapi.jar、freetts.jar、freetts-jsapi10.jar)有关。我的意思是,以某种方式可能会禁止以这种方式使用它们,但也许我在胡说八道。

有谁知道发生了什么?

我发布了 3 个不同的错误,我从 3 个在 IDE 上运行良好的程序发行版进入终端……对不起,很长的帖子

1.

java -jar JSAPIClock.jar 
checkPoint1
java.lang.NullPointerException
    at jsapiclock.JSAPIClock.createSynthesizer(JSAPIClock.java:49)
    at jsapiclock.JSAPIClock.main(JSAPIClock.java:86)
checkPoint2
checkPoint3
checkPoint4
The time is now, almost half past six, in the evening.
Exception in thread "Thread-1" java.lang.NullPointerException
    at jsapiclock.JSAPIClock.speak(JSAPIClock.java:74)
    at jsapiclock.Clock.speakTime(Clock.java:233)
    at jsapiclock.Clock.access$000(Clock.java:41)
    at jsapiclock.Clock$ClockThread.run(Clock.java:269)

2.注意 Speech.properties 文件包含在下面的两个目录中

java -jar HelloWorld.jar 

All general Mode JSAPI Synthesizers and Voices:

Using voice: kevin16
No synthesizer created.  This may be the result of any
number of problems.  It's typically due to a missing
"speech.properties" file that should be at either of
these locations: 

user.home    : /home/yiannis
java.home/lib: /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib

Another cause of this problem might be corrupt or missing
voice jar files in the freetts lib directory.  This problem
also sometimes arises when the freetts.jar file is corrupt
or missing.  Sorry about that.  Please check for these
various conditions and then try again.

3.这其实很奇怪

java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:135)
    at java.util.jar.JarFile.<init>(JarFile.java:72)
    at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:72)
    at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:48)
    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:55)
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
    at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:71)
    at java.net.JarURLConnection.getManifest(JarURLConnection.java:217)
    at java.net.JarURLConnection.getMainAttributes(JarURLConnection.java:269)
    at com.sun.speech.freetts.VoiceManager.getDependencyURLs(VoiceManager.java:251)
    at com.sun.speech.freetts.VoiceManager.getDependencyURLs(VoiceManager.java:283)
    at com.sun.speech.freetts.VoiceManager.getVoiceDirectories(VoiceManager.java:173)
    at com.sun.speech.freetts.VoiceManager.getVoices(VoiceManager.java:110)
    at com.sun.speech.freetts.jsapi.FreeTTSEngineCentral.createEngineList(FreeTTSEngineCentral.java:85)
    at blah2.CustomSpeaker.createSynthesizer(CustomSpeaker.java:34)
    at blah2.FullScreenBox.<init>(FullScreenBox.java:49)
    at blah2.Blah2View.actionPerformed(Blah2View.java:323)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6288)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6053)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4651)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4481)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4481)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
    at java.awt.EventQueue.access$000(EventQueue.java:84)
    at java.awt.EventQueue$1.run(EventQueue.java:602)
    at java.awt.EventQueue$1.run(EventQueue.java:600)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$2.run(EventQueue.java:616)
    at java.awt.EventQueue$2.run(EventQueue.java:614)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
System property "mbrola.base" is undefined.  Will not use MBROLA voices.
java.lang.NullPointerException
    at blah2.CustomSpeaker.createSynthesizer(CustomSpeaker.java:36)
    at blah2.FullScreenBox.<init>(FullScreenBox.java:49)
    at blah2.Blah2View.actionPerformed(Blah2View.java:323)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6288)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6053)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4651)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4481)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4481)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
    at java.awt.EventQueue.access$000(EventQueue.java:84)
    at java.awt.EventQueue$1.run(EventQueue.java:602)
    at java.awt.EventQueue$1.run(EventQueue.java:600)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$2.run(EventQueue.java:616)
    at java.awt.EventQueue$2.run(EventQueue.java:614)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "Thread-1" java.lang.NullPointerException
    at blah2.CustomSpeaker.speak(CustomSpeaker.java:61)
    at blah2.Speaker$SpeakerThread.run(Speaker.java:42)
4

0 回答 0