Do you know how to input a .wav file for a button click in java. this is my code.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String path = System.getProperty("user.dir")+File.separator;
JOptionPane.showMessageDialog(rootPane, path);
InputStream in;
try {
in = new FileInputStream(new File(path+"Audios\\A.wav"));
AudioStream audios = new AudioStream(in);
AudioPlayer.player.start(audios);
}
catch(Exception e){
}
}
in this code when you run in in the netbeans and press execute. the wav file is playing. but when i clean build the solution and press the button from the jar file. The sound is not playing. I want a good reply for this question.