• 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

Head First Java Chapter 11 MiniMiniMusicApp

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am learning Java with the book Head FIrst Java second edition. Now, i am at chapter 11 and want to run the MiniMiniMusicApp.java program.
I get an error :
javax.sound.midi.MidiUnavailableException
at javax.sound.midi.MidiSystem.getDefaultDeviceWrapper(MidiSystem.java:1078)
at javax.sound.midi.MidiSystem.getReceiver(MidiSystem.java:240)
at javax.sound.midi.MidiSystem.getSequencer(MidiSystem.java:442)
at javax.sound.midi.MidiSystem.getSequencer(MidiSystem.java:348)
at MiniMiniMusicApp.play(MiniMiniMusicApp.java:10)
at MiniMiniMusicApp.main(MiniMiniMusicApp.java:45)
Caused by: java.lang.IllegalArgumentException: Requested device not installed
at javax.sound.midi.MidiSystem.getDefaultDevice(MidiSystem.java:1130)
at javax.sound.midi.MidiSystem.getDefaultDeviceWrapper(MidiSystem.java:1076)
... 5 more

I have installed Java JDK 1.6.0.21 on Ubuntu. Is this a well-known problem or do i miss some files?
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Martin Jansen welcome to JR!
It's difficult to answer the question without the book, because, everyone here don't have the book right now. So, please post the question!
 
Martin Jansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, this is the program i have typed in from the book:

No compiler errors, but at runtime the error as i have written above.

 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please => UseCodeTags when you post a code snaps! Use the EDIT button and insert the code tags there! It'll be more readable!
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your code works fine on my Windows XP machine. That makes me believe the issue is OS related. The error message says "Requested device not installed". Do you have a working sound device?
 
Martin Jansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, i use an Asus Eee PC 1201N with well working sound. But i think i must look further to the sound device of my netbook.
 
Martin Jansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally I found a solution (workaround) to run my java program MiniMiniMusicApp on Ubuntu. It seems that Java 1.6 don't support PulseAudio, the audiodevice is already opened by another application or it is a permission problem .
With the command: padsp java MiniMiniMusicApp it works!

(padsp starts the specified program and redirects its access to OSS compatible audio devices (/dev/dsp and auxiliary devices) to a PulseAudio sound server).
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to Java in General.
 
reply
    Bookmark Topic Watch Topic
  • New Topic