Java/Java Media Framework

From Apache OpenOffice Wiki
Jump to: navigation, search

On Linux and other Unix-like systems, requires to install the Java Media Framework (JMF) in order to play sound and video.

This page explains how to install the Java Media Framework and how to configure it for


First we will download the required software. In the following examples, we suppose you download it to the usual directory (on Linux, it's named /home/user/Download [replace 'user' with your user name], although it may vary according to your locale - in Spanish, for example, it's /home/user/Descargas).

Download the JMF Performance Pack for Linux from Oracle's site:

Do not choose the *.zip version, but the *.bin (the latest is named jmf-2_1_1e-linux-i586.bin).

And download also the JMF MP3 Plugin, if you are interested in mp3 support (a quite common format nowadays). You can find it also in Oracle's site:


In this section we explain how to install the JMF. Instead of following the guidelines given in Sun's site, we try to show a more simple way. First, we give the instructions to install the software for the current user only. If you are interested in installing the JMF system-wide, follow the same instructions, you will only need to add then a few extra steps.

Single user

Java Media Framework

We suppose you have downloaded the required software in /home/user/Download. Open a terminal (in the Gnome desktop it is called gnome-terminal, in KDE it is the Konsole), and change the current directory to the place where you downloaded the software:

[user@localhost ~]$ cd  Download

Create a new directory to unpack the software. We name it JMF:

[user@localhost Download]$ mkdir JMF

Copy the JMF Performance Pack binary in that directory (it is better to work with a copy of the downloaded file, because there may be problems during the installation, as several users have reported).

[user@localhost Download]$ cp jmf-2_1_1e-linux-i586.bin JMF/jmf-2_1_1e-linux-i586.bin

Change the working directory to JMF:

[user@localhost Download]$ cd JMF

Now change the file mode to make it executable:

[user@localhost JMF]$ chmod +x jmf-2_1_1e-linux-i586.bin

And execute the "installer" (you don't need root privileges because it will only unpack the files in the current directory, instead of installing them):

[user@localhost JMF]$ ./jmf-2_1_1e-linux-i586.bin

The license text will be displayed on your terminal screen. Scroll down the license by pressing Enter, until you reach the agreement question:

Do you agree to the above license terms? [yes or no]

Type yes to accept it. You will be asked with two more questions. Answer no to them:

Permit recording from an applet? (see readme.html) [yes or no]

Permit writing local files from an applet? (recommend no, see readme.html) [yes or no]

After answering to these questions, the unpacking process will start.

At this point, you may get an error similar to the following:

tail: cannot open `+309' for reading: No such file or directory
./install.sfx.25050: line 1: ==: No such file or directory
./install.sfx.25050: line 3: syntax error near unexpected token `)'

If so, please refer to the "Troubleshooting" section below.

The JMF will try to find the devices in your system. Don't panic if you get some messages telling that it couldn't open some devices:

java.lang.Error: Can't open video card 1
java.lang.Error: Can't open video card 2
java.lang.Error: Can't open video card 3
java.lang.Error: Can't open video card 4
java.lang.Error: Can't open video card 5
java.lang.Error: Can't open video card 6

The important thing is that it finds your sound card (and video card, in case you have one). You can check this later from within the JMStudio, installed with the JMF.

If everything went good, the JMF should be unpacked in /home/user/Download/JMF/JMF-2.1.1e/.

Now we can move the JMF folder to a permanent location in our home directory:

[user@localhost Download]$ mv JMF/JMF-2.1.1e ~/

Finally, we can remove the temporal folder:

[user@localhost Download]$ rm -rf JMF

Next step is installing the mp3 plug-in, if you want support for mp3 files.

JMF MP3 plug-in

Change the current directory to the place where you downloaded the plug-in zip file (latest version is named

[user@localhost ~]$ cd  Download

Create a new directory to unpack it. We name it JAVAMP3:

[user@localhost Download]$ mkdir JAVAMP3

Extract the zip file inside this new folder:

[user@localhost Download]$ unzip -d JAVAMP3/
  inflating: JAVAMP3/copyright.txt
  inflating: JAVAMP3/license.txt
   creating: JAVAMP3/lib/
   creating: JAVAMP3/lib/ext/
  inflating: JAVAMP3/lib/ext/mp3plugin.jar

Then copy the plug-in Java Archive (mp3plugin.jar) inside the JMF folder, together with the other JARs (/home/user/JMF-2.1.1e/lib/):

[user@localhost Download]$ cp JAVAMP3/lib/ext/mp3plugin.jar ~/JMF-2.1.1e/lib/

Finally, we can remove the temporal folder:

[user@localhost Download]$ rm -rf JAVAMP3

JMF Configuration

Once moved to our home directory, we are ready to launch the JMStudio, test the configuration, and add the mp3 plug-in.

To launch the JMStudio, type the following:

[user@localhost Download]$ cd ~/JMF-2.1.1e/bin/
[user@localhost ~]$ ./jmstudio

You will see a window like the following:

Java Media Studio

Select the menu File > Preferences to open the JMF Registry Editor. In the Capture device tab, there may be at least the JavaSound audio capture. If not, press Detect Capture Devices. Problems in this area may be related to your hardware and/or operating system, you should contact their support in case of troubles.

In the Plugins tab, select Codec; enter Press Add, and then Commit.

JMF Registry Editor

If nothing went wrong, close the JMF Registry Editor. You could now play an mp3 audio file. But if a "JMF Registry Error" window pops up displaying an error message ("Could not add item"), and the terminal outputs "java.lang.ClassNotFoundException", then you must close the JMStudio and set some environment variables, then restart the JMStudio and add the mp3 codec as explained above:

user@localhost:~/JMF-2.1.1e/bin$ ./jmstudio 
user@localhost:~/JMF-2.1.1e/bin$ export JMFHOME=/home/user/JMF-2.1.1e
user@localhost:~/JMF-2.1.1e/bin$ export CLASSPATH=$JMFHOME/lib/jmf.jar:$JMFHOME/lib/mp3plugin.jar:$CLASSPATH
user@localhost:~/JMF-2.1.1e/bin$ export LD_LIBRARY_PATH=$JMFHOME/lib:$LD_LIBRARY_PATH
user@localhost:~/JMF-2.1.1e/bin$ ./jmstudio

If you have followed these steps, you should be able to configure now to use the JMF. Notice that if you want the JMF to be accessible for other (Java) applications, like web applets, you should set some environment variables. Read the following section for instructions.


If you want to install the JMF system-wide, so that it is available for every user, follow the same steps as above, and move the ~/JMF-2.1.1e folder from your home to a system-wide location. We will choose /opt. Notice that setting up the JMF will require then root privileges.

Open a terminal, type su and enter the system administrator password.

Then move the JMF to its new location (don't forget to replace 'user' with your user directory name):

[root@localhost ~]$ mv  /home/user/JMF-2.1.1e /opt/

Create a symbolic link to reference in the environment variables (this way it's easier to update):

[root@localhost ~]$ ln -s /opt/JMF-2.1.1e /opt/JMF

Next we have to set global environment variables. We do so by editing (or creating, in case it doesn't exist) a file named in /etc/profile.d/, with the following content:

export JAVA_HOME=/opt/jdk
export JMFHOME=/opt/JMF
export CLASSPATH=$JMFHOME/lib/jmf.jar:$JMFHOME/lib/mp3plugin.jar:$JMFHOME/lib/fobs4jmf.jar:$CLASSPATH

Change JAVA_HOME to the location of the JRE (or JDK). Later we will talk about fobs4jmf.jar. Note that every export command must be in only one line; if the Wiki engine changes that when laying out this page, please write your /etc/profile.d/ removing the extra line breaks if you copy and paste from here.

After rebooting your system, every user could type jmstudio from the command line to launch the JMStudio, with no need to this from the installation directory (/opt/JMF-2.1.1e/bin/).

OpenOffice Configuration

Before being able to use the Java Media Framework to reproduce audio and video in OpenOffice, you must add the JMF library folder to the class path of the Java Virtual Machine launched by You do so with the dialog under Tools > Options:

Tools > Options dialog, Java settings.

Press the "Class Path" button, and add the JMF library folder (if you have chosen the system-wide installation, it is /opt/JMF/lib; if you have installed the JMF just in your home directory, it is /home/user/JMF-2.1.1e/lib).

Java class path settings.

You will need to restart OpenOffice for these changes to take effect.

OOo JavaMediaFramework Tools Options Java Restart.png

After restart, you should be able to play audio and sound supported by JMF. You can try playing one of the sounds from the gallery:

Media Player


If you get an error similar to the following:

tail: cannot open `+309' for reading: No such file or directory
./install.sfx.25050: line 1: ==: No such file or directory
./install.sfx.25050: line 3: syntax error near unexpected token `)'

you will have to edit the installer and correct a line.

There are different ways of doing this, we will use the vim editor.

First we have to clear things up, because this error corrupts the installer file. You can test this by checking its size:

[user@localhost ~]$ cd Download/JMF/
[user@localhost JMF]$ ls -l .
total 8
-rwxrw-r-- 1 user user 4022 ene 21 09:44 install.sfx.25050
-rwxr-xr-x 1 user user    0 ene 21 09:44 jmf-2_1_1e-linux-i586.bin

So remove everything and copy back the file downloaded:

[user@localhost JMF]$ rm -f *
[user@localhost JMF]$ cp ../jmf-2_1_1e-linux-i586.bin .
[user@localhost JMF]$ chmod +x jmf-2_1_1e-linux-i586.bin

Open the file with vim in binary mode:

[user@localhost JMF]$ vim -b jmf-2_1_1e-linux-i586.bin

OOo JavaMediaFramework issue vim 1.png

In the vim editor, type /tail and press ENTER to look for the line to be fixed:

OOo JavaMediaFramework issue vim 2.png

This will find the problematic line.

OOo JavaMediaFramework issue vim 3.png

Then press the key l to move to the left on that line, until the sign +.

Press i to insert text, and insert -n , with a space

OOo JavaMediaFramework issue vim 4.png

Press ESC to stop inserting, and type :wq to write the changes and quit.

Extending JMF

Sun's Java Media Framework comes with support for few formats. You can extend it by installing Fobs4JMF, which is a JMF wrapper for the popular ffmpeg, it can play the most common formats and codecs (ogg, mp3, m4a, divx, xvid, h264, mov, avi, etc):

JMF playing xvid

Please refer to for more details.

Unfortunately there are no recent binaries for Linux (see, so you will have to compile it from the sources.

Once compiled, you don't need to install anything, you just have to copy fobs4jmf.jar and in /opt/JMF/lib/.

TODO: not very complicated explanation of how to compile it (at least in Ubuntu) on people's demand... See Discussion tab, where this request has been requested, of those able to do, and thanks!

Personal tools