December 14th, 2013, 01:20 PM
Cant figure out how to get freeTTS to work in exported executable jar (solved)
Ok first some info about me thats useful,
I am a VERY novice coder, i have mainly written java for mods in a game called minecraft but i find it interesting to program and very rewarding when i see the end result displayed in game, so i decided to write a program to help my DnD group out (yeah im a geek) and to get a better understanding of java as i go.
Now on to my issue, in my mod i use freeTTS to make a peripheral that can be linked with another mod speak, it was all pretty easy to latch up etc but minecraft itself handles the loading of the freeTTS Libs so thats all taken care for me...but in my stand alone program i have no idea how to use the libs,
In eclipse i have them added in the lib folder of my src code and then added them to the build path, all is fine and when i run my code from within eclipse freeTTS works a treat, however when i export the code to an executable jar file it just wont work, removal of the TTS stuff and its fine again.
I have spent the last 3 days googling for help and most of the time i have come across people that have had the issue and then fixed it but not said how, or some one hints how to do it and the other person says ah done but again not how. One post i found suggested using the MANIFEST.MF to specify the libs in the class path i tried that with
but it didnt work
Class-Path: ./lib/freetts.jar ./lib/freetts-jsapi10.jar ./lib/jsapi.jar ./lib/mbrola.jar
I could just remove freeTTS from my code, the program doesnt really need to talk i just wanted it to and part of me is screaming "you will not defeat me!"
The class that deals with all the speech is pretty much the same as the one i use in my mod (with the exception that im not using world or entity data and the package is different ofcourse so better to link that then paste it all here https://github.com/mrgreaper/TwistedMod/blob/master/TwistedMod_common/com/mrgreaper/twisted/client/sounds/SpeechHandler.java )
so the question is how do i tell my executable jar it needs to load these libs from the libs folder when it executes ?
**edit** well thats typical!
basicly after each speech an unimportant error is displayed in the console in eclipse, having decided that the above issue would only be resolved with assistance i endevoured to find out why this error posted and to curb it... i found the solution to that pretty fast, i just needed to modify my speechHandler to include "System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");" i did that and the error message went away, i then exported to an executable jar to re-read the error when the program trys to speak, to get a bit more info to add here...and instead of the error it worked o.O i have no idea why it worked (which will bug me) but an issue thats plagued me for 3 days solid has been resolved and despite the fact im at work im very tempted to do a little dance! lol