Is this maybe a command line application?
Message notifications only work if a MessageManager object has been created. I’m not sure, whether this additionally needs to be done in a graphical environment or if it also works on a Linux without X server.
If you call “addChangeListener(new MyAudioListener());” the MyAudioListener object will be leaked.
As it happens, it is a CLI application and indeed, changing it to a GUI one makes this problem go away.
If I manually do a "runDispatchLoopUntil(40)" then I get some of the messages. So I guess the question is: is there a proper way to have a CLI application pump the message loop?
Oh, that kind of thing isn't really designed to be used in a CLI app.. If you're writing an app that needs an event-loop then you should actually just make it a gui app, but not open any windows. You can run the message loop directy, but it's not generally a good idea.
OK. In my use-case I need to be able to use messaging even from a CLI application. So the question is: how best do run the message loop (and how to relinquish it if a regular GUI app starts)?
Don't understand the question...? if you need a message loop then it's a GUI app (regardless of whether it opens any windows). You can still launch it from the command-line like a CLI app, of course.