This is related to my previous question in that it is the same scenario, just one step further.
I have a testing class called Sample
which is a simple wrapper for a Wave
object from the musicg library:
import com.musicg.wave.Wave;
public class Sample {
private String filename;
private Wave wave;
private WaveHeader waveheader;
public Sample(String filename) {
this.filename = filename;
wave = new Wave(this.filename);
waveheader = wave.getWaveHeader();
}
}
I am trying to initialize a Sample
object by passing an absolute path to the constructor. This works within Eclipse. But once I export a runnable Jar file, I get a java.io.FileNotFoundException upon passing a path to a .wav file that is included in the Jar file. Here's what I get:
java.io.FileNotFoundException: /Users/stas/Documents/java/workspace/EclipseTest/EclipseTest.jar/ORGCSDH1.wav (Not a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.io.FileInputStream.<init>(FileInputStream.java:79)
at com.musicg.wave.Wave.<init>(Wave.java:60)
at stm.vst.test.Sample.<init>(Sample.java:14)
at stm.vst.test.Test.populateSamples(Test.java:70)
at stm.vst.test.Test.main(Test.java:14)
What I am stumped by is the (Not a directory)
part. This is not very helpful, as obviously it shouldn't be a directory, either. This is different from a File not Found exception. The file is verifiably there.
I should remark that I am new to runnable Jar files, so I am sure there is something very simple I am missing.