aspose file tools*
The moose likes Beginning Java and the fly likes Head First Java chapter 11 MiniMiniMusicApp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First Java chapter 11 MiniMiniMusicApp" Watch "Head First Java chapter 11 MiniMiniMusicApp" New topic
Author

Head First Java chapter 11 MiniMiniMusicApp

Rob Gman
Greenhorn

Joined: Jan 20, 2008
Posts: 3
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
Vijay Raj
Ranch Hand

Joined: Oct 10, 2005
Posts: 110
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.
roshni bhagat
Greenhorn

Joined: Jan 31, 2008
Posts: 6
have you written the same code as in book or added something...because i have run the same code and it runs very well
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
Not quite sure what the UnsatisfiedLinkError means, but it might be worthwhile reinstalling your JDK.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Since this seems to stem from a native method call, I'm also curious what operating system you're using.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Rob Gman
Greenhorn

Joined: Jan 20, 2008
Posts: 3
Ubuntu.... perhaps I should have mentioned that at the start?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
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.
Arnout Engelen
Greenhorn

Joined: Dec 28, 2008
Posts: 1
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).
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

"raboof",

Please read your private messages regarding an important announcement.

Thank you,

Rob


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
"Rob Gman" you have a similar private message; make sure to read it please.
Atlantis Lacy
Greenhorn

Joined: Jul 23, 2008
Posts: 5
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
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
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.
 
subject: Head First Java chapter 11 MiniMiniMusicApp