• 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: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting a rather nasty error at runtime when trying to get this very simple sound player to work, I get the same error with the code I typed out and the pre-written code that comes with the book :-/ so i guess there is nothing wrong with the code? Here is it



and this is the runtime error


Exception in thread "main" java.lang.UnsatisfiedLinkError: init_
at gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.init_(libgcj.so.81)
at gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.<clinit>(libgcj.so.81)
at java.lang.Class.initializeClass(libgcj.so.81)
at java.lang.Class.newInstance(libgcj.so.81)
at gnu.classpath.ServiceProviderLoadingAction.run(libgcj.so.81)
at java.security.AccessController.doPrivileged(libgcj.so.81)
at gnu.classpath.ServiceFactory$ServiceIterator.loadNextServiceProvider(libgcj.so.81)
at gnu.classpath.ServiceFactory$ServiceIterator.<init>(libgcj.so.81)
at gnu.classpath.ServiceFactory.lookupProviders(libgcj.so.81)
at javax.sound.midi.MidiSystem.getMidiDeviceInfo(libgcj.so.81)
at javax.sound.midi.MidiSystem.getSequencer(libgcj.so.81)
at MiniMiniMusicApp.play(MiniMiniMusicApp.java:12)
at MiniMiniMusicApp.main(MiniMiniMusicApp.java:6)



if anyone can tell me what this means i'd be very grateful
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at java.lang.UnsatisfiedLinkError in API doc, it says

Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native



Vijay.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
have you written the same code as in book or added something...because i have run the same code and it runs very well
 
Marshal
Posts: 79233
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not quite sure what the UnsatisfiedLinkError means, but it might be worthwhile reinstalling your JDK.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this seems to stem from a native method call, I'm also curious what operating system you're using.
 
Rob Gman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ubuntu.... perhaps I should have mentioned that at the start?
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rob Gman:
Ubuntu.... perhaps I should have mentioned that at the start?


Interesting. I found that AlsaMidiDeviceProvider seems to be part of open source Java sound from Tritonus.org. You might try updating/reinstalling that, or perhaps find an alternative.
 
Campbell Ritchie
Marshal
Posts: 79233
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have had UnsatisfiedLinkErrors on Ubuntu 5 before now, but not on Ubuntu 6.04 or 6.10. Might still be worthwhile trying to reinstall your JDK.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ran into the same. Looks like you have 'tritonus' installed (which should give you access to ALSA MIDI though the Java Sound API), but the native library wasn't loaded.

You can load the native library with:



This gets rid of the linking error (but still doesn't quite seem work for me: the ALSA MIDI device shows up in qjackctl, but connecting it to kmidimon doesn't show any notes coming though).
 
Sheriff
Posts: 22784
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
"raboof",

Please read your private messages regarding an important announcement.

Thank you,

Rob
 
Campbell Ritchie
Marshal
Posts: 79233
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Rob Gman" you have a similar private message; make sure to read it please.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know if this is resolved but I removed the chapter 11 statement at the top of the code just before the import.

Atlantis lacy
 
Campbell Ritchie
Marshal
Posts: 79233
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By "removed" do you mean the package statement? Since package names are used when invoking class files with the JVM, that might make a lot of difference. There are bits in the Java Tutorials about packages, here too, which are worth reading.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic