I don’t know why, but without digging into it more, all I can say right now is that I can’t use the Java Sound API from within SBT. Whenever I try running
sbt run, I keep getting the following error message, even though I know that my app and sound file work fine when I package my Java application normally:
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
As part of the debugging process I created a little shell script named run.sh that contained these two lines:
sbt package scala -classpath "lib/littlelogger-0.1.jar:target/scala-2.10/typewriter_2.10-1.0.jar" com.valleyprogramming.typewriter.GainTester
The first line packages my Scala source code into a Jar file, and the second line sets my classpath while running my application (
GainTester) with the Scala interpreter. For some reason this shell script works fine, but trying to run the code from within SBT yields the error I showed initially.
While that problem remains a mystery, if you ever wanted to see how to run a Scala Jar file while also setting the classpath, I hope that last line is helpful.