Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
java sound problem
Hendra Kurniawan
Ranch Hand
Posts: 239
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public static void main(String[] args){ MySound mySound = new MySound(); mySound.playSound(); }
public class MySound { private AudioInputStream audio = null; public MySound(){ try { audio = AudioSystem.getAudioInputStream(New File("C:\\windows\\media\\notify.wav")); } catch (UnsupportedAudioFileException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } public void playSound(){ try { Clip clip = AudioSystem.getClip(); clip.open(audio); clip.start(); } catch (LineUnavailableException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } }
I ran main over and over again, but no sound whatsoever. but if I debug as, the sound plays just fine. I use
java
6. thanks
Hendra Kurniawan
Ranch Hand
Posts: 239
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
never mind, solved it. stupid
thread
problem. Moderator may delete this thread if deemed necessary. sorry for the inconvenience.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Understanding how this code works
Java sound: how to play a file?
Queston on exceptions
Audio format conversion problems
JAR + Including Files
More...