0

I've been searching for an answer all night and morning and I'm almost about to give up. I was hoping someone here has had the same problem has and has figured it out.

Basically, I've developed a project on Windows using Eclipse and I would like to run it on my Raspberry Pi. Of course it's no problem, normally, but I'm trying to use a library.

The library is FreeTTS. It works fine on Windows but when I go to use it on my Pi, it can't find the location of the library. I've tried everything and my brain in fried.

The structure of my project is: bin - compiled classes src - source files lib - libraries (include freetts.jar)

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/speech/freetts/VoiceManager

In Eclipse, I have the libs connected to the project relatively.

Any ideas?

BrandonMXB
  • 79
  • 1
  • 1
  • 7
  • What is the command you're executing to run your program on the Pi? – Boann Mar 01 '14 at 13:35
  • What sort of manifest file do you have? – Hovercraft Full Of Eels Mar 01 '14 at 13:38
  • @Boann I've tried all of the following, and more combinations: java -Djava.library.path=/home/pi/BPi/lib -classpath /home/pi/BPi/bin com.brandonmxb.bpi.Main java -classpath /home/pi/BPi/bin com.brandonmxb.bpi.Main sudo java -cp lib/freetts.jar com.brandonmxb.bpi.Main – BrandonMXB Mar 01 '14 at 13:42
  • @HovercraftFullofEels (I like your name) I'm not specifying any specific manifest. Just some JARS that go with FreeTTS and some of my own classes. – BrandonMXB Mar 01 '14 at 13:46
  • What about `java -cp bin:lib/freetts.jar com.brandonmxb.bpi.Main` ? By the way Wikipedia says FreeTTS is dead (?) – Boann Mar 01 '14 at 13:48
  • Yes! The whole time I didn't notice I was using "." as the current path which made no sense. I just spent almost 7 hours trying to figure this out, while my brain melted. And hearing my program FINALLY working. Haha thank you so much! You answered my question. :) – BrandonMXB Mar 01 '14 at 13:55
  • Oh, okay! I'll post that as an answer below then. – Boann Mar 01 '14 at 14:00

1 Answers1

1

From the directory containing bin and lib, your command should look like:

java -cp bin:lib/freetts.jar com.brandonmxb.bpi.Main

That puts both the bin directory and the jar on the classpath, separated by : (; on Windows).

Boann
  • 48,794
  • 16
  • 117
  • 146
  • Thank you so much. Works perfectly! Saved me from more headaches :) To readers: This was a question to do with running your program with certain libraries, not about FreeTTS. :D – BrandonMXB Mar 01 '14 at 14:03