in my eclipse when i run it, everything works fine and audio is okay, but i have problem when i create my .jar executable file. Audio file is in my package and i read it with getResourceAsStream so i just want to let you know. Here is problem..
InputStream input = getClass().getResourceAsStream("/optician/funny-doorbell.wav");
AudioInputStream audioIn;
try{
Clip clip;
audioIn = AudioSystem.getAudioInputStream(input);
clip=AudioSystem.getClip();
clip.open(audioIn);
clip.start();
} catch (UnsupportedAudioFileException | IOException e1) {
e1.printStackTrace();
} catch (LineUnavailableException e1) {
e1.printStackTrace();
}
In this first case when i run with eclipse, it works fine, but when i run .jar executable file i get : reset/mark not supported.
Second case is everything same but :
BufferedInputStream input = (BufferedInputStream) getClass().getResourceAsStream("/optician/funny-doorbell.wav");
So everything is same, point is this that i now try with BufferedInputStream but the problem i get now is : Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.new.www.protocol.jar.JarURLConnection$JarURLInputStream cannot be cast to java.io.BufferedInputStream
I tried in linux and windows but it doesn't works. Where is the problem ?