My wife has been using Ubuntu rather than Windows Vista, since Ubuntu 8.04 over a year ago. There were some growing pains in the beginning, but she's pretty happy now. One of the biggest problems was caused whenever she would play an online game on Pogo, which uses Java, it would basically take over the sound card, not allowing sound from any other application. The only way to restore sound was to shutdown Firefox, an annoying deal when she had open windows/tabs to many sites. Until Ubuntu 9.10 I simply changed her shortcuts to run Firefox with the "padsp" wrapper. This always worked fine, but with Ubuntu 9.10, using "padsp" with Firefox just hangs, either due to a bug in padsp or Firefox or both, I don't know. I found several bugs filed regarding this problem but no solutions. Documented here is my solution.
I first tried using the OpenJDK/IcedTea open source java solution. While this is certainly improving, it simply failed with many of the online games, or, in some cases it would work, but perform slowly or hang after a game or two. Since these games worked fine with the Sun Java 1.6 I needed a solution for that. Running java via "padsp" seemed to work from the command line, so my idea was to write a simple wrapper script that would run java with "padsp" transparently. Here what I came up with:
#!/bin/bash
padsp /usr/java/jre1.6.0_12/bin/java.bin "$@"
Basically, I renamed the real java binary to "java.bin" and dropped the above shell script in it's place. That way running the command "java" actually runs "padsp java" and thus redirects sounds via PulseAudio. Since it's replacing the binary that the plugin calls it works for the Java plugin as well. This allows sound from Java applications to play simultaneously with all other PulseAudio capable applications, including current Flash plugins, and applications like VLC.
Obviously the above script would need to be tweaked based on the path that you're java is installed and the version, and you'd need to fix it again each time you upgraded java, but it's the best solution that works with the plugin that I've been able to figure out. I'd be interested if others have a better solution. Hopefully Sun Java 1.7 will support PulseAudio or OpenJDK support will continue to improve so that it will work with Java based games more reliably.
Sunday, February 7. 2010 at 11:31 (Reply)
Thursday, March 4. 2010 at 16:19 (Link) (Reply)
I did a script.sh and i edit it with this lines:
#!/bin/bash
padsp /usr/local/jre1.6.0_16/bin/java.bin "$@"
I execute it but it not work.
What is wrong?
Thanks!
Friday, March 5. 2010 at 21:55 (Link) (Reply)
Saturday, March 6. 2010 at 17:11 (Link) (Reply)
Thursday, April 22. 2010 at 07:03 (Reply)
This will be valid for all versions of Ubuntu/Java.
Sunday, May 2. 2010 at 22:13 (Reply)
Monday, June 21. 2010 at 19:41 (Link) (Reply)
/usr/lib/jvm/java-6-sun/jre/bin/