Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've got a very minimalistic setup of ubuntu precise, created using debootstrap. So please don't assume that any packages are installed just because they usually are. On that system, I'd like to play some sounds from a java applet. However, this always fails with the following error message:

javax.sound.midi.MidiUnavailableException: Can not open line
    at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1132)
    at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1036)
    ...
Caused by: java.lang.IllegalArgumentException: No line matching interface
        SourceDataLine supporting format PCM_SIGNED 44100.0 Hz,
        16 bit, stereo, 4 bytes/frame, little-endian is supported.
    at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:476)
    at javax.sound.sampled.AudioSystem.getSourceDataLine(AudioSystem.java:604)
    at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1066)
    ... 35 more

As the messages mention a soft synthesizer, and pcm lines, I expect that the lack of some midi daemon is not the issue here. As far as I can tell, the alsa kernel modules are loaded, including snd_hda_intel, snd_pcm, snd_seq_midi among others. I've also included the alsa-base and alsa-utils packages in my installation. alsa-mixer looks good, using “HDA Intel PCH” as its default device.

What other packages, configuration settings or daemon startups does java require to make its sound output work?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

I've solved this myself. Using strace (I love this tool!), I found out that java attempts to access various alsa sound control devices. Most of them don't exist (ENOENT), but the first and primary one gives (EPERM) indicating insufficient permissions.

From there, the fix was obvious: the device in question belongs to the audio group, but the user running the java applet in question does not. Adding him to that group made the error message disappear.

I'm still not hearing any sound, but that might be due to some other problem, located within the applet itself.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.