public void openSound() { if (!sound.isOpen()) { try { AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(soundPath); sound = AudioSystem.getClip(); sound.open(audioInputStream); } catch (Exception e) { System.out.println("The sound from file " + String.valueOf(soundPath) + "was not found!"); System.out.println(e); } } }