jarograv 0 Newbie Poster

I am working on a java application that will display an image and play a sound. It finds the current month and displays the appropriate information. Below is the code that I have been testing (that's why santa is in april) it will not work when trying to play wav or mp3 files but displays the image fine when run without the sound playing code.

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.io.File;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import java.util.Calendar;



public class ShowImage extends Panel {
    static Calendar cal = Calendar.getInstance(); 

BufferedImage  image;
private static final String holidaysimages[] = {
  "santa.jpg", "valentine.jpg", "bunny.jpg", "bunny.jpg", "summer.jpg", "summer.jpg", 
  "summer.jpg", "summer.jpg", "turkey.jpg", "turkey.jpg", "turkey.jpg", "santa.jpg"};
private static final String holidayssounds[] = {
      "santa.mp3", "valentine.jpg", "santa.wav", "santa.wav", "summer.jpg", "summer.jpg", 
      "summer.jpg", "summer.jpg", "turkey.jpg", "turkey.jpg", "turkey.jpg", "santa.mp3"};
  public ShowImage() throws Exception {

try {
    String imageName= holidaysimages[cal.get(Calendar.MONTH)];
    File input = new File(imageName);
    image = ImageIO.read(input);
} catch (IOException ie) {
  System.out.println("Error:"+ie.getMessage());
}
        File soundFile = new File(holidayssounds[cal.get(Calendar.MONTH)]);
        AudioInputStream sound = AudioSystem.getAudioInputStream(soundFile);
        DataLine.Info info = new DataLine.Info(Clip.class, sound.getFormat());
        Clip clip = (Clip) AudioSystem.getLine(info);
        clip.open(sound);
        clip.addLineListener(new LineListener() {
          public void update(LineEvent event) {
            if (event.getType() == LineEvent.Type.STOP) {
              event.getLine().close();
              System.exit(0);
            }
          }
        });
        clip.start();
  }

  public void paint(Graphics g) {
g.drawImage( image, 0, 0, null);
  }

  static public void main(String args[]) throws Exception {
JFrame frame = new JFrame("Display image");
Panel panel = new ShowImage();
frame.getContentPane().add(panel);
frame.setSize(500, 500);
frame.setVisible(true);
  }
}

The current error code that I am getting is;
"Exception in thread "main" java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED 48000.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian is supported.
at javax.sound.sampled.AudioSystem.getLine(Unknown Source)
at ShowImage.<init>(ShowImage.java:39)
at ShowImage.main(ShowImage.java:58)"

Thanks in advance,

Jaro