Java Sound for Linux Netscape

This is the README for libmoss-2.1a.
The latest version of this README should be available at

As far as I can tell, the Linux version of Netscape Navigator/Communicator (the latest release as of this writing was Netscape Communicator 4.6) does not support the playing of sound by Java applets.

I have hacked up a replacement for Netscape's implementation of (the Java class) (including some JRI native C code) which enables the Netscape Java VM to play sound.


The Hacks

Here's a gzipped tar file with the source and binaries for my hacks:

To use these hacks you (most probably) need:

  1. Linux. Right now I'm running 2.2.9, I used to run with 2.0.xx and it worked then. As far as I know 2.1.xx should work fine too.
  2. A supported sound driver. I'm using the stock OSS/Free driver which is bundled with the 2.2.9 kernel. Any modestly recent version of this driver (or the commercial version) should work. For awhile I used the new ALSA sound driver (version 0.2.0pre8) which seemed to work fine too. As of 2.0, libmmoss supports EsounD as well. It is important that you either have a working /dev/audio device file, or a working esd.
  3. A soundcard. I'm using a cheapie ES1688 clone. Anything that works with your sound driver should be fine.
  4. Netscape Communicator 4.xx. Older versions of this code worked with Navigator 3.01. I think this version should as well, but I haven't tested it with 3.01. (You can get netscape here.)


Precompiled binaries are included with this distribution, so no compilation should be necessary.

The kludge consists of three parts:

The compiled, hacked-up Java code.
This is contained in the libmmoss.jar JAR file. (Navigator 3.01 doesn't know about JAR files, if you are using 3.01, you will have to install the individual class files by hand. See below.)
The compiled native code.
This is in the shared library
A wrapper shell-script.
This sets up environment variables so that netscape can find the hacks, then runs the real netscape.

``Automatic'' Installation

If you're running Netscape Communicator 4.xx, the included Makefile should be able to install the hacks for you. (If it doesn't work, or if you'd like to install the hacks manually, see the next section. (If you are running Navigator 3.xx, see the old installation notes below.)

  1. Inspect and edit the Makefile. Pay particular attention to the settings of MOZILLA_HOME which specifies where you have installed Communicator. Also check the settings of pkgdir and bindir, which control where the hacks will be installed.
  2. Run `make'. This should generate the netscape wrapper,
  3. Inspect and edit It may need modification, particularly if you have other fancy plugins (e.g. Acrobat Reader, RealAudio player, etc...) installed. There are notes at the end of regarding how I've dealt with these.
  4. Important Note: Before you do the next step, know that 'make install' will install the wrapper script (by default) in /usr/local/bin/netscape. It will overwrite any wrapper script (or binary) you might already have installed there so make sure this is okay!
  5. Run `make install' to install the hacks. You probably need to become root to do this, unless you've modified the paths in the Makefile to point to directories in which you have write permission.
  6. Make sure your PATH includes bindir, the directory in which the wrapper was installed (default: /usr/local/bin).
  7. You may want to load this CA certificate. (More on this below.)
  8. Try it out. Run `netscape'. Then see the section on testing below.

Manual Installation

For more hints on manual installation, see the file (Or run `make', then look at

Annoying Popup Windows?

With Communicator 4.xx (and later), when my code loads, you will get a dialog box which requests permission to load a native library. You'll have to grant permission for the hacks to work. As of libmmoss version 2.0, you'll also be asked to grant permission to make network connections. You only really need to grant this if you want the EsounD support.

Since, I'm not about to pay money to obtain a certified signing certificate, if you want to be able to verify the signature on the libmmoss.jar file, you'll have to download (and trust) this certificate. You only need to do this if you want the ``Remember This Decision'' checkbox on the popup dialog to work. (Note that my old certificate and the one before that even have expired, so even if you've downloaded the certificate(s) for previous versions of libmoss, you'll still have to download the new one.) (FWIW, the fingerprint of the certificate is 6D:7D:D6:AD:9C:E0:30:EE:CC:26:DD:24:AA:0A:9C:6A.)


Libmmoss can now output sound through esd, the EsounD sound daemon. You do not need to do anything special to enable esd support, libmmoss will, if possible, output to esd and fall back to /dev/audio output, if not.

The ESPEAKER environment variable, if set, is used to find the esd. Esd support can be disabled by setting ESPEAKER to none.

Currently the esd support works okay but not great for me. Problems include:

I'd appreciate feedback on how well the esd support is working for you. Drop me a note with any comments or suggestions.


Javasoft has a dog-barking, train-whistling demo in their tutorial. (You have to find the applet, and then hit some buttons.)

They also have a more vocal demo here.


If you have trouble getting libmmoss to work, the first thing you should do is take a look at Netscape's Java Console while trying to play sounds. (In Communicator 4.x, you can get to the Java Console via the menubar: select Communicator->Tools->Java Console.)

The first time you try to play a sound, libmmoss will print an identifying message on the Java Console. If you do not see something like

Loading Libmmoss-2.0
    Java sound for Linux Netscape
    by G. T. Dairiki 
    (see )
then Netscape is not finding libmmoss.jar. Check the setting of CLASSPATH in your netscape wrapper script.

Once you get past the ``Loading Libmmoss'' message, libmmoss should spew various messages which may or may not help determine why you're not getting any sound.

If you get really stuck, feel free to e-mail me. If possible, include whatever Java Console output you get in your note.

Appendix A - Installation for Navigator 3.01

Since Navigator does not know about JAR files, you must install the individual class files, of which there are now four:

These files need to be installed in some standard place; I suggest installing them in the netscape installation directory under, (e.g.) /usr/local/netscape/java/classes/. You also still need to install the native code, as described above.

The environment variables LD_LIBRARY_PATH, and CLASSPATH should probably be set something like:

export LD_LIBRARY_PATH=/usr/local/netscape/lib
export CLASSPATH=/usr/local/netscape/java/classes


If you want and/or need to include the Netscape class archive (e.g. java_301) in your CLASSPATH make sure that the path to my hacks is listed before the standard class archive.
Right: CLASSPATH=/usr/local/netscape/java/classes:/where/ever/java_301
Wrong: CLASSPATH=/some/where/java_301:/usr/local/netscape/java/classes

For Navigator 3.01, you should not need to list the class archive in your CLASSPATH, as long as you have it installed in one of the ``standard places'':

    or /usr/local/lib/netscape/java_301.

Appendix B - Netscape Crashes

Netscape Navigator 3.01 tends to crash frequently (particularly when using Java) unless one is using an older version of Netscape apparently attempts to free() invalid memory pointers. (Either NULL pointers, or pointers to memory which has already been free()ed.) It seems the newer libc's are more intolerant of this behaviour.

These crashing problems seem to be fixed in Communicator 4.03. So this section does not apply if you are running Communicator.


I ran netscape on, and it seems to work pretty well. (I have it installed in /lib/old/, and made a symbolic link /usr/local/netscape/lib/ -> /lib/old/ Then I run netscape with LD_LIBRARY_PATH=/usr/local/netscape/lib.) The cleanest fix seems to be just to preloading an older, less finicky version or the malloc/free code. I have recently switched over to using this kludge - it seems to work too. More details on this scheme can be found here.

The I use can be found in gnumalloc.tar.gz. Which was apparently contributed by Doug Ridgeway. Thanks Doug!

Appendix C - ChangeLog

Current version is libmmoss-2.1a.tar.gz

Changes from libmmoss-2.1.tar.gz
Released 6 Jul, 1999.

Changes from libmmoss-2.0.tar.gz
Released 14 Jun, 1999.

Changes from libmmoss-1.4a.tar.gz
Released 8 Jun, 1999.

Changes from libmmoss-1.4.tar.gz
Released 25 May, 1999.

Changes from libmmoss-1.3.tar.gz
Released 16 March, 1999.

Changes from libmmoss-1.2.tar.gz
Released 6 October, 1998.

Changes from libmmoss-1.1.tar.gz
Released 14 October, 1997.

Changes from libmmoss-0.4.tar.gz
Released 16 June, 1997.

Changes from libmmoss-0.02.tar.gz
Released 28 May, 1997.

Geoffrey T. Dairiki

If you have comments or suggestions, email me at