play sound 'wav file' with AudioClip : WAV Sound « Development « Java Tutorial

import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JFrame;

public class MainClass extends JFrame {
  AudioClip click;

  public static void main(String[] args) {
    new MainClass();

  public MainClass() {
    this.setSize(400, 400);
    this.setTitle("Mouse Clicker");
    this.addMouseListener(new Clicker());

    URL urlClick = MainClass.class.getResource("hit.wav");
    click = Applet.newAudioClip(urlClick);


  private class Clicker extends MouseAdapter {
    public void mouseClicked(MouseEvent e) {;

6.49.WAV Sound sound 'wav file' with AudioClip
6.49.2.Play sound with AudioInputStream